Re: Difference between variables and functions
joe_at_invalid.address
Date: 08/30/05
- Next message: Alexander Farber: "Re: How to check if a pipe is still being read, without writing anything to it?"
- Previous message: Keith Thompson: "Re: Difference between variables and functions"
- In reply to: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Next in thread: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Reply: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Reply: Wayne C. Morris: "Re: Difference between variables and functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Alexander Farber: "Re: How to check if a pipe is still being read, without writing anything to it?"
- Previous message: Keith Thompson: "Re: Difference between variables and functions"
- In reply to: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Next in thread: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Reply: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Reply: Wayne C. Morris: "Re: Difference between variables and functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|