Right. There is an XLC compiler option ANSIFUNCS or something like that. (Too 
lazy to look it up.) It tells the compiler "things that have the names of 
standard functions really ARE standard functions." Without that option turned 
on, strlen() could be a private random number generator.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Bernd Oppolzer
Sent: Sunday, February 23, 2014 10:53 AM
To: [email protected]
Subject: Fwd: Re: Curious observation: lack of a simple optimization in a C 
program

An explanation, which is just a little more paranoid:

if you #undef strlen, the compiler cannot be sure, if "your" strlen is not 
quite another function, which does not give the same result on two subsequent 
calls ... ???


-------- Original-Nachricht --------
Betreff:        Re: Curious observation: lack of a simple optimization in a C 
program
Datum:  Sun, 23 Feb 2014 19:48:44 +0100
Von:    Bernd Oppolzer <[email protected]>
An:     IBM Mainframe Discussion List <[email protected]>



I would strongly suggest not to #undef such #defines coming from the standard 
headers; the results may be unpredictable.

Maybe the compiler optimization and inlining strategies relies exactly on such 
#defines, that is:

strlen needs to be __strlen, so that the compiler can recognize it and do the 
optimizations on it that it is supposed to do ???

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to