public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Where should g++ find a 'max' macro or function ?
@ 2003-11-10 12:17 Michael Svetlik
  2003-11-10 12:53 ` Eljay Love-Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Svetlik @ 2003-11-10 12:17 UTC (permalink / raw)
  To: gcc-help

Hi, folks.

I'm sure, somewhere in a mailing list archive around the globe is the answer - 
I'm too blockheaded to find it.

The problem: a little file
/* -------------------------------------------------------- */
int maxxx (int a, int b) {
	return max(a,b);
}
/* -------------------------------------------------------- */
is pushed into g++ for compilation :
>> g++ -o max.o -c max.c
and produces :
max.c: In function `int maxxx(int, int)':
max.c:4: `max' undeclared (first use this function)
max.c:4: (Each undeclared identifier (bla blaaa ....)

g++ is
>>Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs
Configured with: /home/michl/sources/gnu/gcc-3.2.3/configure 
--enable-languages=c,c++
Thread model: posix
gcc version 3.2.3

The output of
>> g++ -E max.c
is 
<output>
# 1 "max.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "max.c"

int maxxx (int a, int b) {

        return max(a,b);



}
</output>

Strange, g++-2.95.3 is capable of translating it correctly, but doesn't 
produce the 'built-in' stuff with '-E'.

I've checked Stroustrup, as well as the archive here, without success. Anyone 
there, who has an idea ?

TIA
Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-11-11 13:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 12:17 Where should g++ find a 'max' macro or function ? Michael Svetlik
2003-11-10 12:53 ` Eljay Love-Jensen
2003-11-10 18:31   ` Michael Svetlik
2003-11-11 13:19     ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).