Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
7Raiden8787y@Mitiko yup, if you are American and/or speak American English. I'm Italian and I like it more the British way!
-
-eth18617yint i = 0;
for(; i<5; i++)
{
k = my_array[i];
if(k % 5 == 0) break;
}
t = my_array[i].val;
...
Maybe you need it, maybe you must comply to C89 specs... -
viking817427yOk...
I just have to..
double x;
if(x == 1) not if(x = 1) - that is assignment :P
And if you have a double, please don't compare, use diff to a specific precision. -
7Raiden8787y@-eth True that, and I don't see nothing bad with it. Also, what if you create an additional variable with a *meaningful* name (such as the one that indicates why you broke the loop)?
-
7Raiden8787y@viking8 there's no typo in my post. I meant the assignment (otherwise where would the rant be ;) ).
Also, sometimes you need special case handling, like if something is not as expected you make x = -1. In other case of course you should include a tolerance! -
@nicholai it wasn't until C89 I think. You actually *had* to declare every variable on the very top of your function
-
@nicholai ikr
And before ANSI C, function definitions looked like this:
main(argc, argv) // 'int' assumed as return type and as type for 'argc'
char** argv;
{
// code
}
How much I hate when I see
double x;
if (x = 1)
do_something();
Seriously, why is that so appealing to you?
As well as
int i = 0;
for (; i < n; ++i)
do_something();
undefined
initialise variables
every time you do this a kitten dies
just stop it