Funny mistake

Josef Wolf Sepp at ppcger.ppc.sub.org
Wed Mar 20 07:41:54 AEST 1991


roy%cybrspc at cs.umn.edu (Roy M. Silvernail) writes:
] rainer at boulder.Colorado.EDU (Rainer Malzbender) writes:
] > I believe my Datalight (Zortech) compiler actually issues a warning if you
] > say "if(a=b)", something like "possible unintended assignment".
] Turbo also issues "Possibly incorrect assignment" for constructs like
] 'if(x=get_key())...'.

Do you really want this? Do you really want the compiler crying every
time you write something like the following (just an example)

while ( get_data (...) && (p = malloc (...))) {
  ...
}

well, you could write something like

while (get_data (...)) {
  p = malloc (...);
  if (!p)
    break;
  ...
}

but the first one seems to be more clearly to me...

Greets
    Sepp

| Josef Wolf, Germersheim, Germany | +49 7274 8047  -24 Hours- (call me :-)
| ...!ira.uka.de!smurf!ppcger!sepp | +49 7274 8048  -24 Hours-
|     sepp at ppcger.ppc.sub.org      | +49 7274 8967  18:00-8:00, Sa + Su 24h
|  "is there anybody out there?"   | all lines 300/1200/2400 bps 8n1



More information about the Comp.lang.c mailing list