|
BadKarma wrote: That's correct, in fact here we encourage people to use
the most ugly, unwell formed and disaster bringing code
that they may come up to. Poke tongue
Or otherwise known as: Job Security
|
|
|
|
|
We should write our own coding standard.
For beginner
- Writing Code Horrors for dummies
- Learn to Code in Horror Style in 21 days
For Professionals
- Advanced Horror Techniques : When template gone wrong
- Gibberish : Take your obfuscation skill to a higher level
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
BadKarma wrote: That's correct, in fact here we encourage people to use
the most ugly, unwell formed and disaster bringing code
that they may come up to.
I think you should have had some coffee before making this statement, as he is exactly right. Placing the constant first will catch this error, which is one of the common typographic errors in C-style languages.
|
|
|
|
|
Real C programmers (i.e. real men) don't use such girly tricks. They bravely make mistakes whenever is needed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am not talking about a single or some person who can take care his code itself nicely. But when you will come to some big organization then Why they follows some process becausethey want minimize defects, minimize manpower,etc. So this small care can save some time .
Truth Can'nt be changed
|
|
|
|
|
asadullah ansari wrote: minimize manpower
Hence not a real-men company!
BTW What is the point on minimizing manpower in software industry? Our work is creative after all, don't you agree?
The Software Laborer
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
We should create the union of real men, excuse me, C programmers. We'd fight to protect our jobs, our interests and our bugs!
To those who understand, I extend my hand.
To the doubtful I demand: Take me as I am.
Not under your command, I know where I stand.
I won't change to fit yout plan. Take me as I am.
|
|
|
|
|
leonej_dt wrote: We should create the union of real men, excuse me, C programmers.
Definitely.
leonej_dt wrote: We'd fight to protect our jobs,
That's not needed. Other 'programmers' with their 'masterpieces' keep our jobs safe.
leonej_dt wrote: We'd fight to protect our our interests and our bugs!
Definitely again.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: BTW What is the point on minimizing manpower in software industry? Our work is creative after all, don't you agree?
The Software Laborer
*SEXIST STATEMENT WARNING* I like to maximize the girl power in my environment...as long as I get to stick around as the token alpha male *END SEXIST STATEMENT*
|
|
|
|
|
Oh, a coding standards horror.
That only works when comparing an Lvalue and an Rvalue, and if a programmer can remember to do that, then he can remember to use the correct operator in the first place.
Newbies will continue to screw it up, and experienced programmers will continue to get it right the first time.
One company I worked for did have that in the coding standard, but even the guy who defined the standards admitted that it was pretty useless.
If it causes you trouble you could switch to D, which will throw an error if it's not done right (if I recall correctly).
|
|
|
|
|
PIEBALDconsult wrote: That only works when comparing an Lvalue and an Rvalue, and if a programmer can remember to do that, then he can remember to use the correct operator in the first place.
Newbies will continue to screw it up, and experienced programmers will continue to get it right the first time.
You've obviously never worked a 48-hour day.
|
|
|
|
|
No, uh uh. The longest day I ever worked was 28 hours... and I fell asleep.
|
|
|
|
|
Yes, because actually looking at your warnings is apparently too difficult.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: Yes, because actually looking at your warnings is apparently too difficult.
I had a manager once, who was quite skilled in C programming, but who would often leave warnings in his code if he thought they were trivial...which left him open to missing new warnings that weren't. He's a lawyer now.
|
|
|
|
|
Ahh, those with negative men points could always use
#define equals ==
which brings a nice touch to the code
int a = 3;
if( a equals 3)
{
...
}
But why stop here, just add the following
#define if if(
#define then ){
#define endif }
And youre code will look like this
if a equals 3 then
...
endif
It somehows reminds me of another language, I just can't get my fingers on the name ...
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
LOL. I remember someone suggesting defines like this:
#define please
#define thanks
And the code would be much more pleasant to read:
please do {
...
} while (i < imax);
thanks
|
|
|
|
|
Doesn't LOLCode do something similar to this?
HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
INVISIBLE "ERROR!"
KTHXBYE
Imagine that you are hired to build a bridge over a river which gets slightly wider every day; sometimes it shrinks but nobody can predict when. Your client provides no concrete or steel, only timber and cut stone (but they won't tell you what kind). The coefficient of gravity changes randomly from hour to hour, as does the viscosity of air. Your only tools are a hacksaw, a chainsaw, a rubber mallet, and a length of rope.
Welcome to my world.
-Me explaining my job to an engineer
|
|
|
|
|
I laughed really hard at this one!
To those who understand, I extend my hand.
To the doubtful I demand: Take me as I am.
Not under your command, I know where I stand.
I won't change to fit yout plan. Take me as I am.
|
|
|
|
|
You haven't dealt with object equality.
I know as a random key monkey, it's very dificult for me to remember that
objA == objB
is not the same as
objA.equals(objB)
Can you provide the best answer. I have to get the bugs out of the LCG framework before Thursday!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Guideline 1: Always compile cleanly on warning level 4.
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
Johann Gerell wrote: Guideline 1: Always compile cleanly on warning level 4.
Gudeline 2: Turn on the option: "Treat warnings as errors".
|
|
|
|
|
Even better, you could use #pragma to convert that particular warning into an error (I think it's possible anyways)
|
|
|
|
|
Nemanja Trifunovic wrote: Gudeline 2: Turn on the option: "Treat warnings as errors".
I do that for release builds, but not debug.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Actually, writing
if (x = 0) ...
does not generate any warning at all (at least in VS 2005). Looks like this is a flaw in the compilor.
|
|
|
|
|
ed welch wrote: Actually, writing
if (x = 0) ...
does not generate any warning at all (at least in VS 2005).
Of course it does. But you have to enable warning level 4 (as I pointed out in the "guideline") in the project property pages under C/C++ > General. Then you get this:
warning C4706: assignment within conditional expression
If you also set that warnings should be treated as errors, you get this:
error C2220: warning treated as error - no 'object' file generated
warning C4706: assignment within conditional expression and that way you just cannot miss the assignment.
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|