 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Because "while(1)" is a common idiom, and avoids the ugly goto.
>
> Either that or for(;;) { ... }
...and to think people complain when a Haskell programmer writes
fix ((1:) . scanl (+) 1)
or something... :-P
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> (Another less fancy way would be to return a null pointer from the
> function, in which case the program will end with a segmentation fault.)
Well, maybe if you're lucky. :-) Otherwise, it just goes off happily
executing whatever is at memory address zero (or whatever NULL maps to).
--
Darren New / San Diego, CA, USA (PST)
Helpful housekeeping hints:
Check your feather pillows for holes
before putting them in the washing machine.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Darren New <dne### [at] san rr com> wrote:
> Warp wrote:
> > (Another less fancy way would be to return a null pointer from the
> > function, in which case the program will end with a segmentation fault.)
> Well, maybe if you're lucky. :-) Otherwise, it just goes off happily
> executing whatever is at memory address zero (or whatever NULL maps to).
I'm pretty sure POSIX or some other type of standard states that jumping
to the null pointer will always cause a segmentation fault.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>> Warp wrote:
>>> (Another less fancy way would be to return a null pointer from the
>>> function, in which case the program will end with a segmentation fault.)
>
>> Well, maybe if you're lucky. :-) Otherwise, it just goes off happily
>> executing whatever is at memory address zero (or whatever NULL maps to).
>
> I'm pretty sure POSIX or some other type of standard states that jumping
> to the null pointer will always cause a segmentation fault.
But not the C standard. Try it on MS-DOS, Win 3.1, AmigaDOS, a credit
card terminal, a cell phone, etc. :-) Basically, you're saying you
can't have a POSIX-compliant system without memory mapping, methinks.
But C is used in particular because of its primitiveness and lack of
reliance on a particular complex bit of hardware.
"The operating system is there to provide the facilities the language
designer left out."
--
Darren New / San Diego, CA, USA (PST)
Helpful housekeeping hints:
Check your feather pillows for holes
before putting them in the washing machine.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |