www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1998/07/13/14:17:36

X-pop3-spooler: POP3MAIL 2.1.0 b 4 980420 -bs-
Date: Mon, 13 Jul 1998 10:09:17 -0400 (EDT)
From: Stea Greene <insomnia AT degobah DOT core DOT binghamton DOT edu>
X-Sender: insomnia AT degobah
Reply-To: Stea Greene <insomnia AT degobah DOT core DOT binghamton DOT edu>
To: tBeastium Mailing List <beastium-list AT Desk DOT nl>,
Vincent Diepeveen <diep AT xs4all DOT nl>
Subject: Re: weird things of gcc
In-Reply-To: <3.0.32.19980711232836.0097a3f0@xs4all.nl>
Message-ID: <Pine.SUN.3.93.980713095801.3030B-100000@degobah>
MIME-Version: 1.0
Sender: Marc Lehmann <pcg AT goof DOT com>
Status: RO
Lines: 45

On Sat, 11 Jul 1998, Vincent Diepeveen wrote:

> Hello,
> 
> Forgive me my criticism, but after setting up linux i now try to compile
> diep for unix, and i get some weird results trying to compile with the
> standard gcc in redhat 5.1 (gcc --version gives: 2.7.2.3 ):
> 
> first of all, why doesn't gcc have a predefined function like msvc++ have 
> called:
>   max() and min()?
> 
	(Assuming I am thinking about your max() and min() functions
correctly): Well, actually, it does. GCC has an even better implimentation
of these than vc++.  The >? and <? operators for Max and Min respectively.
ie:
	2 >? 4 = 4
	2 <? 4 = 2

	Be warned however, that these may only work in C++ (I'm not sure).
If you want it to be compatable w/ vc++, just add:

#ifdef __GNUC__
#define max(a, b) (a >? b)
#define min(a, b) (a <? b)
#endif

To the beginning of your code.  Than you can use the min() and max()
functions the same way in both compilers and gcc will be able to optimize
for it.

> "the 'gets' function is dangerous and should not be used."
 
> What the #$$##$ does gcc think it's saying to me, am i not allowed to
> get a string from the keyboard, is there a bug in this function?

	This is, just as it says, a dangerous function.  All you have to
do is hit too many keys for the buffer given to gets() and BOOM!  It isn't
that you're not allowed to do it, gcc is just politely recomending that
you don't.

					--Insomnia

						--Sleep is for the weak!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019