Re: Difference between variables and functions

joe_at_invalid.address
Date: 08/30/05


Date: 30 Aug 2005 01:17:21 -0500

Ulrich Hobelmann <u.hobelmann@web.de> writes:

> Wow, I've never experienced C being that anal about types (except
> when it doesn't know the size of a struct that it needs for
> allocation). I assumed that it's all just memory addresses
> underneath, with some loose checking on top.

The OP's code set an int to 4. Then it tried to call the value 4 as a
function, which would mean (I guess) that the compiler was expected to
generate code that would just jump to address 4 and start executing.

There have been several good responses based on the definition of
C. I'm just wondering why you think it would be a good thing for the
compiler to blissfully cast the number 4 to a pointer to function and
try to start executing code at that address?

I'm not an expert though, I'm just asking. The fact that it won't do
that seems more like reasonable than anal to me.

Joe



Relevant Pages

  • Re: OO languages
    ... Memory management is always a tricky subject. ... move them to a place where the compiler will tolerate... ... make sure "automatic allocation" can work in a reasonably ... Not sure if I can blame that or not, but it crashed when my alarm ...
    (comp.arch.embedded)
  • Re: OO languages
    ... Memory management is always a tricky subject. ... move them to a place where the compiler will tolerate... ... as it is hard to get deterministic performance when you don't ... make sure "automatic allocation" can work in a reasonably ...
    (comp.arch.embedded)
  • Re: Mex Overflow Error Using Free Borland Compiler
    ... > I need help eliminating the source of the following Mex runtime error. ... > Borland compiler handles overflow errors. ... > The first thing I tried is dynamic memory allocation. ...
    (comp.soft-sys.matlab)
  • Re: Benchmark: STLs list vs. hand-coded one
    ... bound - in fact it is hard to find anything in a compiler that isn't ... allocation bound (perhaps the scanner as it spends a rather large ... How many people have a Gbyte of memory? ... seems to have a gig of RAM. ...
    (comp.arch.embedded)
  • Re: allocatable non-dummy local variables and pointers to them
    ... must release the memory used by a process when the process terminates. ... I do remember that Fortran Powerstation 4.0 did have a memory leak ... digging to find whether it claims to be an f90 or f95 compiler. ... compiler has to behave for allocatables that get undefined allocation ...
    (comp.lang.fortran)