[comp.lang.c++] Zortech C++ V1.07 serious bug

psrc@pegasus.ATT.COM (Paul S. R. Chisholm) (09/15/89)

In article <13629@well.UUCP>, nagle@well.UUCP (John Nagle) writes:
> int min(int x, int y) { (x<y) ? x : y; } 
> int max(int x, int y) { (x>y) ? x : y; }

That's the problem.  C++ inline functions aren't macros.  True, many
compilers wil effectively return the last expression evaluated, and it
would be nice if Zortech warned you that the functions consisted only
of statements with no effect.  But your code really needs to say what
it means:

int min(int x, int y) { return (x<y) ? x : y; } 
int max(int x, int y) { return (x>y) ? x : y; }

Paul S. R. Chisholm, AT&T Bell Laboratories
att!pegasus!psrc, psrc@pegasus.att.com, AT&T Mail !psrchisholm
I'm not speaking for the company, I'm just speaking my mind.