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
Search - "int foo() { foo(); }"
-
One of our devs seems to love "attribution" comments in anything he writes.
private void foo() { //Author: John Cribbins
...public static final int FOO_BAR = 21; //Author: John Cribbins
I mean, I get it for an author tag at the top of a file, but certainly not on every field or method. Is this some kind of weird thing newer devs are encouraged to do these days?!9 -
Find the odd one out :
a) const int * foo
b) int const * foo
c) const * int foo
d) int * const foo7 -
I lost points for not including the following comment:
//Declaring variables
int foo, bar;
I already knew how to code, and I completed the assignment in the fewest number of lines needed while still being well commented explaining my logic. I lost points because I didn't say what everyone understood.4 -
When coworkers leave the co. for a better paying job and leave this kind of code after themselves:
int foo = 1;
String.format("blabla %s", Integer.toString(foo));
fml6 -
For a long time I was of the opinion that pointer variables in C/C++ should have the asterisk immediately after the type name (e.g. int* foo).
Eventually I became convinced that it makes more sense to have it before the variable (e.g. int *foo).
Now I find routines that return pointers look weird, e.g.: void *allocate_something() so I am considering adopting the original style I used.
The only advantage of having the asterisk before the variable name I am aware of is that it is easier to remember to add an asterisk if you define more than one pointer on that line.
Anyone else find it hard to settle on code style guidelines for their own personal projects?12 -
int* foo(); and int& foo();
if you're a
int *foo(); and int &foo();
kinda guy, you're fucking weird. And also wrong12 -
try{
someObject.someAttribute = (int?) reader["columnName"];
}catch{
someObject.someAttribute = null;
}
Or, same coworker, another piece of code:
if(((int?)reader["foo"]).HasValue){
bar = (int?)reader["foo"];
}else{
bar = null;
}