Re: Difference between variables and functions

From: Wayne C. Morris (wayne.morris_at_this.is.invalid)
Date: 08/30/05


Date: Tue, 30 Aug 2005 17:29:10 GMT

In article <m37je4kky6.fsf@invalid.address>, joe@invalid.address wrote:

> 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.
>
Well, that's what his code tried to do, but that's not what he intended; he
thought he should be allowed to have both a function and a variable named
"read" in the same scope, and that the C compiler should be "smart enough"
to figure out from context which 'read' was being referenced. The OP
simply asked whether this really is invalid in C.

Ulrich thought the OP *wanted* to call a function at memory address 4,
resulting in this tangential discussion about whether C should let you
'call' an int variable without an explicit cast.



Relevant Pages

  • Re: Strange problem with semaphores and localtime_r function.
    ... The localtime_r function thinks a 'struct tm' ... it will exceed 'sizeof' as reported by your header files. ... The next memory allocation will happen inside ...
    (comp.unix.programmer)
  • 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)