* Re: ccc error [not found] <Pine.LNX.4.10.10101090204570.19797-100000@cc42593-a.taylor1.mi.home.com> @ 2001-01-09 7:26 ` jeff.sturm 2001-01-09 9:49 ` Georg Wittig 2001-01-09 13:51 ` Greg Lindahl 0 siblings, 2 replies; 9+ messages in thread From: jeff.sturm @ 2001-01-09 7:26 UTC (permalink / raw) To: axp-list Does anyone know if the following is valid C: extern int a; extern int b; void f(int x) { (x ? a : b) = 1; } gcc compiles it fine, ccc fails with: cc: Error: t.c, line 5: In this statement, "(x?a:b)" is not an lvalue, but occurs in a context that requires one. (needlvalue) (x ? a : b) = 1; --------^ GCC contains similar constructs, so I'd think it's portable C. Where can one submit bug reports for ccc? Jeff ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ccc error 2001-01-09 7:26 ` ccc error jeff.sturm @ 2001-01-09 9:49 ` Georg Wittig 2001-01-09 9:58 ` Uncle George 2001-01-09 16:35 ` Michal Jaegermann 2001-01-09 13:51 ` Greg Lindahl 1 sibling, 2 replies; 9+ messages in thread From: Georg Wittig @ 2001-01-09 9:49 UTC (permalink / raw) To: axp-list jeff.sturm@appnet.com wrote: > Does anyone know if the following is valid C: > > extern int a; > extern int b; > > void f(int x) { > (x ? a : b) = 1; > } (OT, because this question has nothing to do with axp) Don't know if it's valid C. But remember you can always write this as * (x? &a : &b) = 1; -- Georg Wittig, GMD Georg.Wittig@gmd.de - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Du hast keine Spracherkennung installiert? Doch Komma aber Mai Stenz Macht Sie den um Gang mit dem Juice nett auch nicht leichter. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ccc error 2001-01-09 9:49 ` Georg Wittig @ 2001-01-09 9:58 ` Uncle George 2001-01-09 16:35 ` Michal Jaegermann 1 sibling, 0 replies; 9+ messages in thread From: Uncle George @ 2001-01-09 9:58 UTC (permalink / raw) To: axp-list [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=x-user-defined, Size: 258 bytes --] I dunno, but ccc is exclusively axp ( true64 & linux/alpha ) /gat Georg Wittig wrote: > > > (OT, because this question has nothing to do with axp) > > Don't know if it's valid C. But remember you can always write this as > * (x? &a : &b) = 1; > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ccc error 2001-01-09 9:49 ` Georg Wittig 2001-01-09 9:58 ` Uncle George @ 2001-01-09 16:35 ` Michal Jaegermann 1 sibling, 0 replies; 9+ messages in thread From: Michal Jaegermann @ 2001-01-09 16:35 UTC (permalink / raw) To: axp-list On Tue, Jan 09, 2001 at 10:49:41AM +0100, Georg Wittig wrote: > jeff.sturm@appnet.com wrote: > > > > Does anyone know if the following is valid C: > > > > extern int a; > > extern int b; > > > > void f(int x) { > > (x ? a : b) = 1; > > } > > > (OT, because this question has nothing to do with axp) > > Don't know if it's valid C. No, it is not. gcc has a number of extentsions. In particular it will accept expressions as "lvalues" ("lvalue", in short, is something which can show up on the left hand side of an assignment). 'info gcc' and try to find 'Lvalues' under 'C Extensions'. > But remember you can always write this as > * (x? &a : &b) = 1; This should have the same problem as the above but if you will expand it to int *p = (x? &a : &b) ; *p = 1; which is really the same thing (and probably will compile to the same code as the original '(x ? a : b) = 1;'), and is valid C. What is wrong with void f(int x) { if (0 != x) a = 1; else b = 1; } You can even squish that into a one line if you really want to. :-) BTW, 'if(x)' will earn you moanings from gcc; you would have to write 'if((x))' if you are (mis)saving on an explicit test. Michal ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: ccc error 2001-01-09 7:26 ` ccc error jeff.sturm 2001-01-09 9:49 ` Georg Wittig @ 2001-01-09 13:51 ` Greg Lindahl 2001-01-09 13:59 ` Thomas Leitner 2001-01-09 16:51 ` Jeff Sturm 1 sibling, 2 replies; 9+ messages in thread From: Greg Lindahl @ 2001-01-09 13:51 UTC (permalink / raw) To: axp-list > Does anyone know if the following is valid C: > > extern int a; > extern int b; > > void f(int x) { > (x ? a : b) = 1; > } This is a gcc extension. You can look in the info pages to see what gcc has as extensions, or you can use the -ansi flag on gcc to get it to issue warnings about its own extensions. I believe that the ccc people plan on eventually adding all of gcc's extensions to ccc, which would be a great boon to AlphaLinux users. -- g ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: ccc error 2001-01-09 13:51 ` Greg Lindahl @ 2001-01-09 13:59 ` Thomas Leitner 2001-01-09 16:51 ` Jeff Sturm 1 sibling, 0 replies; 9+ messages in thread From: Thomas Leitner @ 2001-01-09 13:59 UTC (permalink / raw) To: axp-list On Tue, 9 Jan 2001, Greg Lindahl wrote: > > extern int a; > > extern int b; > > > > void f(int x) { > > (x ? a : b) = 1; > > } > > This is a gcc extension. You can look in the info pages to see what gcc has > as extensions, or you can use the -ansi flag on gcc to get it to issue > warnings about its own extensions. > > I believe that the ccc people plan on eventually adding all of gcc's > extensions to ccc, which would be a great boon to AlphaLinux users. They already did this, at least for Compaq C++ 6.3. There's the "-std gnu" switch which causes the compiler to digest many gnu extensions. Tom -- -------------------------------------------------------------------------- Dr. Tom Leitner Dept. of Communications Graz University of Technology, e-mail: tom@radar.tu-graz.ac.at Inffeldgasse 12 Phone: +43-316-873-7455 A-8010 Graz / Austria / Europe Fax: +43-316-463-697 Home page : http://wiis.tu-graz.ac.at/people/tom.html PGP public key on : ftp://wiis.tu-graz.ac.at/pgp-keys/tom.asc or send mail with subject "get Thomas Leitner" to pgp-public-keys@keys.pgp.net -------------------------------------------------------------------------- Before we have the paperless office, we have the paperless toilet! ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ccc error 2001-01-09 13:51 ` Greg Lindahl 2001-01-09 13:59 ` Thomas Leitner @ 2001-01-09 16:51 ` Jeff Sturm 2001-01-09 18:05 ` ccc error [OT] Chris Eleveld (Sector 7 Group) 1 sibling, 1 reply; 9+ messages in thread From: Jeff Sturm @ 2001-01-09 16:51 UTC (permalink / raw) To: axp-list Greg Lindahl wrote: > > void f(int x) { > > (x ? a : b) = 1; > > } > > This is a gcc extension. You can look in the info pages to see what gcc has > as extensions, or you can use the -ansi flag on gcc to get it to issue > warnings about its own extensions. Thanks. In fact I have to use -pedantic to get any warnings: [jsturm@toronto tmp]$ gcc -c -pedantic f.c f.c: In function `f': f.c:4: warning: ISO C forbids use of conditional expressions as lvalues > I believe that the ccc people plan on eventually adding all of gcc's > extensions to ccc, which would be a great boon to AlphaLinux users. This example is apparently OK with several compilers besides gcc. I was just curious who is right/wrong so I don't annoy the wrong people with a bug report ;) (Sorry if this is OT. I know there are many ccc users here...) -- Jeff Sturm jeff.sturm@commerceone.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ccc error [OT] 2001-01-09 16:51 ` Jeff Sturm @ 2001-01-09 18:05 ` Chris Eleveld (Sector 7 Group) 2001-01-09 18:20 ` Michal Jaegermann 0 siblings, 1 reply; 9+ messages in thread From: Chris Eleveld (Sector 7 Group) @ 2001-01-09 18:05 UTC (permalink / raw) To: axp-list ANSI/ISO C forbids a non-modifiable L value. Its a very common extension to allow however. When we upgraded to the latest AIX compilers we saw the same error in much of our code. The reason is much the same as: int main(int argc, char **argv) { int i; char *c; /* follow is in error */ (int *)c = &i; /* however the follwoing is correct */ c = (char *)&i; return 0; } On Tue, Jan 09, 2001 at 11:51:16AM -0500, Jeff Sturm wrote: > Greg Lindahl wrote: > > > void f(int x) { > > > (x ? a : b) = 1; > > > } > > > > This is a gcc extension. You can look in the info pages to see what gcc has > > as extensions, or you can use the -ansi flag on gcc to get it to issue > > warnings about its own extensions. > > Thanks. In fact I have to use -pedantic to get any warnings: > > [jsturm@toronto tmp]$ gcc -c -pedantic f.c > f.c: In function `f': > f.c:4: warning: ISO C forbids use of conditional expressions as lvalues > > > I believe that the ccc people plan on eventually adding all of gcc's > > extensions to ccc, which would be a great boon to AlphaLinux users. > > This example is apparently OK with several compilers besides gcc. I was just > curious who is right/wrong so I don't annoy the wrong people with a bug report > ;) > > (Sorry if this is OT. I know there are many ccc users here...) > > -- > Jeff Sturm > jeff.sturm@commerceone.com > > > > _______________________________________________ > Axp-list mailing list > Axp-list@redhat.com > https://listman.redhat.com/mailman/listinfo/axp-list ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ccc error [OT] 2001-01-09 18:05 ` ccc error [OT] Chris Eleveld (Sector 7 Group) @ 2001-01-09 18:20 ` Michal Jaegermann 0 siblings, 0 replies; 9+ messages in thread From: Michal Jaegermann @ 2001-01-09 18:20 UTC (permalink / raw) To: axp-list On Tue, Jan 09, 2001 at 12:05:11PM -0600, Chris Eleveld (Sector 7 Group) wrote: ... > When we upgraded to the latest AIX compilers > we saw the same error in much of our code. .... > > int > main(int argc, char **argv) > { > int i; > char *c; > > /* follow is in error */ > (int *)c = &i; And you should be glad that it is. Writing such nasties is one of reasons for all this "unaligned access" crap, with associated performance hits, which you see later on Alpha. Michal ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2001-01-09 18:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Pine.LNX.4.10.10101090204570.19797-100000@cc42593-a.taylor1.mi.home.com>
2001-01-09 7:26 ` ccc error jeff.sturm
2001-01-09 9:49 ` Georg Wittig
2001-01-09 9:58 ` Uncle George
2001-01-09 16:35 ` Michal Jaegermann
2001-01-09 13:51 ` Greg Lindahl
2001-01-09 13:59 ` Thomas Leitner
2001-01-09 16:51 ` Jeff Sturm
2001-01-09 18:05 ` ccc error [OT] Chris Eleveld (Sector 7 Group)
2001-01-09 18:20 ` Michal Jaegermann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox