Joe Wright <> writes:
> John Devereux wrote:
>> "Mark B" <> writes:
>>
>>> "John Devereux" <> wrote in message
>>> news:...
>>>
>>><snip>
>>>
>>>>Actually gcc for example will typically silently replace
>>>>
>>>> printf("Hello\n");
>>>>
>>>>with
>>>>
>>>> puts("Hello\n");
>>>
>>>Doubtful... those 2 lines are not equivalent.
>> So I see! I should have been either more accurate, or more vague.
>> gcc replaces calls to printf() with calls to puts()... when it
>> thinks
>> it can.
>> I was trying to show by example that C compilers can indeed use
>> "compiler magic", in this case to call an entirely different function
>> from what was expected.
>> Perhaps this behaviour is not compatible with standard C, in which
>> case, I'm sorry for mentioning it!
>>
> You missed the point perhaps. The printf() example is not equivalent
> because puts() supplies its own '\n'.
No, thanks, I understood that (after Robert Gamble supplied a
clue). Though I think you were the only person to say this explicitly!
I had to look up puts() - previously I had only ever seen it in debug
dumps, when trying to find out why printf() was missing from the
object file!
Anyway, who in their right mind could possibly have expected puts() to
do that? Stupid function...mutter...
--
John Devereux