comp.lang.ada
 help / color / mirror / Atom feed
From: stefan-lucks@see-the.signature
Subject: Re: YACT (Yet Another C Trap)
Date: Mon, 30 Aug 2010 10:21:40 +0200
Date: 2010-08-30T10:21:40+02:00	[thread overview]
Message-ID: <Pine.LNX.4.64.1008301014490.28149@medsec1.medien.uni-weimar.de> (raw)
In-Reply-To: <c02d8eee-bf6f-406e-8d24-f741798c7e11@y11g2000yqm.googlegroups.com>

On Sun, 29 Aug 2010, Maciej Sobczak wrote:

> > int x = 10,000; // oops, it will compile, perhaps even without
> > warnings. Happy debugging!
> 
> Did you actually tried or are just repeating unchecked nonsense?
> The above example is explicitly handled (forbidden) by both C and C++
> standards - comma has special meaning in declarators.

I tried it out. The above example gives an error. But the following 
program compiles without warnings with gcc:

#include <stdio.h>
int main (int argc, char **argv)
{ float x;

    x = 12,3;

    if (x > 12.1) printf("greater"); else printf("smaller or equal");
  printf(" than 12.1.\n");
}

Here is what it does:

> gcc flaw.c    
> ./a.out
smaller or equal than 12.1.

Is this a language flaw of C, or a bug in gcc?


-- 
------ Stefan Lucks   --  Bauhaus-University Weimar  --   Germany  ------
               Stefan dot Lucks at uni minus weimar dot de
------  I  love  the  taste  of  Cryptanalysis  in  the  morning!  ------




  reply	other threads:[~2010-08-30  8:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21  9:32 YACT (Yet Another C Trap) mockturtle
2010-08-27  4:13 ` Shark8
2010-08-29 20:55 ` Maciej Sobczak
2010-08-30  8:21   ` stefan-lucks [this message]
2010-08-30  7:52     ` Maciej Sobczak
2010-08-30  8:28     ` stefan-lucks
2010-08-30 10:13       ` Peter C. Chapin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox