Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > noreturn

Reply
Thread Tools

noreturn

 
 
Nobody
Guest
Posts: n/a
 
      08-20-2012
On Sun, 19 Aug 2012 22:23:47 -0400, Lew Pitcher wrote:

>> I suppose that fork() belongs in the same boat.

>
> ITYM execlp() and friends


No, that belongs in the "never returns to its caller" boat.

> fork() always returns to the caller


Usually twice, only the second "caller" is in a process which didn't even
exist when fork() was called.

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      08-20-2012
Ralph Spitzner <> writes:
> Keith Thompson wrote:
> [...]
>>
>> the compiler is not required to diagnose the error -- but neither is it
>> required to generate any code for the printf() call. (And with gcc, it
>> can produce no output or crash with a segmentation fault, depending on
>> the optimization level).

>
> Ok, got it now, sorry Willem too, didn't mean to offend.
> Maybe I'm just getting old, not seeing advantages of
> this or that keyword/qualifier


In general, the advantage of such qualifiers (restrict, noreturn
-- even register) is to give more information to the compiler.
In most cases, the compiler is free to ignore that information,
but it provides an opportunity for optimization.

In many cases, the information is in the form of a promise made
by the programmer to the compiler. The compiler is free to rely
on that promise -- and if the programmer has lied (e.g., using
`noreturn` on a function that does return to its caller), then the
compiler can take bloody revenge (or, more realistically, generate
code that doesn't behave as it would in the absence of the promise).

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57