E
E. Robert Tisdale
Allan said:How about people style for the following?
x = (a==3 ? 5 : 60);
No!
int x = (3 == a)? 5: 60;
Allan said:How about people style for the following?
x = (a==3 ? 5 : 60);
E. Robert Tisdale said:Please plonk me while you're at it.
E. Robert Tisdale said:No!
int x = (3 == a)? 5: 60;
Martin Dickopp said:But your poll is not very likely to produce different results with
different methods.
To achieve that, you would have to pick an example
where people tend to vote "tactically" in a single vote system
Default User said:Not on your life Trollsdale. You are far too dangerous.
On Wed, 12 May 2004 21:47:49 GMT, in comp.lang.c ,
Thats a bit rude.
The question you asked was which we preferred. Ed
answered that - AJ or AA.
Is this clear now?
Actually, it's far better.
I find the topic of single winner election methods to be fascinating.
And probably other places as well ;-)here here
Mark McIntyre said:By the way I've just realised you're Eric Gorr the Troll from 2003. I
propose to therefore respond no further in this thread, and see how it
develops. If your posts return to last year's trollishness....
Thanks again Dan for your standard insight in this very important
matter! ;-)
This closes the discussion; we must all obey the C standard. The
styles other than AJ are blatantly off-topic.
Kees
I thought it might be fun to run a simple vote to discover the most
preferred spacing style for a simple if statement with a single, simple
boolean test. By my count, there are 32 possible variations for this
case. Here is a complete list.
AZ: if(a > b)
BA: if(a >b )
BB: if(a >b)
BC: if(a> b )
BD: if(a> b)
BE: if(a>b )
BF: if(a>b)
I thought it might be fun to run a simple vote to discover the most
preferred spacing style for a simple if statement with a single, simple
boolean test. By my count, there are 32 possible variations for this
case. Here is a complete list.
AA: if ( a > b )
AB: if ( a > b)
AJ: if (a > b)
AP: if (a>b)
AP: if (a>b)
Allan said:x = (a == 3 ? 5 : 60) ;
Charles said:won't that evaluate to
x = (a == 5);
or have i missed something about the ternary operator's precedence?
Charles said:Won't that evaluate to
x = (a == 5);
Or have I missed something about the ternary operator's precedence?
#include <stdio.h>> cat main.c
60 = x> gcc -Wall -std=c99 -pedantic -o main main.c
> ./main 2
5 = x> ./main 3
Mark A. Odell said:Then drop the unecessary ones you have included. ?: is higher in
precedence than = so you can just write:
x = 3 == a ? 5 : 60;
Not to rekindle this argument
Mabden said:I am not trying to eliminate all parens,
in fact I like unnecessary ones, for instance around
"sizeof (int)".
pete said:Those parens that you're showing there, are necessary.
Mabden said:Remember people, we are professional writers.
Allan Bruce said:I think he maybe meant;
int a;
a = sizeof a;
Allan
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.