www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/22/03:21:10

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: v2 unwanted warnings
Date: Thu, 21 Nov 1996 20:31:06 -0800
Organization: Three pounds of chaos and a pinch of salt
Lines: 50
Message-ID: <32952C8A.3728@cs.com>
References: <EF21E372FE AT fs2 DOT mt DOT umist DOT ac DOT uk>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp211.cs.com
Mime-Version: 1.0
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A.Appleyard wrote:
> 
>   Please reply to me also in person, as I had to unsubscribe from djgpp email
> group due to email intray overload. I am sorry to keep troubling you.
> 
>   (0) About how many messages are there per day now on djgpp email group?

It's around 40-50 nowadays, but as Eli suggested you can simply read the
newsgroup.  ;)

>   I have just had my first go with v2, which I downloaded from Hensa at
> Lancaster (England) today. I have a big program (a text editor), which v1 has
> compiled many times under -Wall without complaint, but under v2 with -Wall:-

v1 and v2 are substantially different compilers.  I suggest seriously
that you read the v2 FAQ (v2/faq202b.zip) for information on all the
changes.

>   (2) Can this warning be suppressed specifically, similarly?:-
>     `warning: suggest parentheses around assignment used as truth value'

No!  It is a very bad idea to suppress this sort of warning.  The
precedence of the '=' and '==' operators can be very confusing, and if
you do it wrong you'll get undesired results.  For example:

  if ( x = y == z )
     ...

In this expression, (y == z) is evaluated first, and the value of that
expression is assigned to x.  If this is truly what you intended, then
you should explicitly put parentheses around the (y == z).  If not, then
this is a serious bug in your program, and should be replaced by:

  if ( ( x = y ) == z )
     ...

That warning is there because the compiler is unable to distinguish
between correct and incorrect applications of these operators.  Eli
suggested a method to use, but you should only use it if you KNOW that
all your truth expressions are correct!

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>+ W++ N++ o+ K? w(---) O-
M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+ tv+() b+++ DI++ D++ G e(*)>++++
h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


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