Click here to Skip to main content
15,912,329 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralOne guidelines for C/C++ programmer Pin
asadullah ansari8-Sep-08 4:03
asadullah ansari8-Sep-08 4:03 
In your project, If you are using if condition like

enum
{
  Blue_c,
  Yellow_c,
  Red_c  
};
int color;

if( color == yellow_c)
{
  .....
  ......
}
or
if(color != Red_c)
{
   ....
   .....
} 


Now you know by mistake if you forget one = or !
means if(color = yellow_c) or if(color = Red_c)
then no error will come and bug fixing cost for your projects

So To avoid this cost you should use

if(yellow_c == color)
{
  .....
  ......
}
or
if(Red_c != color)
{
   ....
   .....
} 


Now if you forgot to put one = ot ! then compilation error will come..

So this should be in coding standard to use like this...

Truth Can'nt be changed

AnswerRe: One guidelines for C/C++ programmer Pin
leppie8-Sep-08 4:40
leppie8-Sep-08 4:40 
JokeRe: One guidelines for C/C++ programmer Pin
BadKarma8-Sep-08 4:46
BadKarma8-Sep-08 4:46 
JokeRe: One guidelines for C/C++ programmer Pin
leppie8-Sep-08 4:49
leppie8-Sep-08 4:49 
GeneralRe: One guidelines for C/C++ programmer Pin
BadKarma8-Sep-08 5:11
BadKarma8-Sep-08 5:11 
GeneralRe: One guidelines for C/C++ programmer Pin
cpkilekofp25-Sep-08 4:10
cpkilekofp25-Sep-08 4:10 
JokeRe: One guidelines for C/C++ programmer PinPopular
CPallini8-Sep-08 9:05
mveCPallini8-Sep-08 9:05 
GeneralRe: One guidelines for C/C++ programmer Pin
asadullah ansari9-Sep-08 2:58
asadullah ansari9-Sep-08 2:58 
GeneralRe: One guidelines for C/C++ programmer Pin
CPallini9-Sep-08 3:14
mveCPallini9-Sep-08 3:14 
JokeRe: One guidelines for C/C++ programmer Pin
leonej_dt18-Sep-08 21:43
leonej_dt18-Sep-08 21:43 
JokeRe: One guidelines for C/C++ programmer Pin
CPallini18-Sep-08 21:57
mveCPallini18-Sep-08 21:57 
GeneralRe: One guidelines for C/C++ programmer Pin
cpkilekofp25-Sep-08 4:12
cpkilekofp25-Sep-08 4:12 
GeneralRe: One guidelines for C/C++ programmer Pin
PIEBALDconsult8-Sep-08 17:36
mvePIEBALDconsult8-Sep-08 17:36 
GeneralRe: One guidelines for C/C++ programmer Pin
cpkilekofp25-Sep-08 4:13
cpkilekofp25-Sep-08 4:13 
GeneralRe: One guidelines for C/C++ programmer Pin
PIEBALDconsult25-Sep-08 5:33
mvePIEBALDconsult25-Sep-08 5:33 
GeneralRe: One guidelines for C/C++ programmer Pin
Joe Woodbury8-Sep-08 17:50
professionalJoe Woodbury8-Sep-08 17:50 
GeneralRe: One guidelines for C/C++ programmer Pin
cpkilekofp25-Sep-08 4:14
cpkilekofp25-Sep-08 4:14 
GeneralRe: One guidelines for C/C++ programmer PinPopular
BadKarma8-Sep-08 20:36
BadKarma8-Sep-08 20:36 
GeneralRe: One guidelines for C/C++ programmer PinPopular
Nemanja Trifunovic9-Sep-08 5:11
Nemanja Trifunovic9-Sep-08 5:11 
GeneralRe: One guidelines for C/C++ programmer Pin
Robert Royall9-Sep-08 9:51
Robert Royall9-Sep-08 9:51 
GeneralRe: One guidelines for C/C++ programmer Pin
leonej_dt18-Sep-08 21:44
leonej_dt18-Sep-08 21:44 
QuestionRe: One guidelines for C/C++ programmer - codz plz Pin
Nagy Vilmos8-Sep-08 22:04
professionalNagy Vilmos8-Sep-08 22:04 
RantRe: One guidelines for C/C++ programmer Pin
Johann Gerell9-Sep-08 0:30
Johann Gerell9-Sep-08 0:30 
GeneralRe: One guidelines for C/C++ programmer Pin
Nemanja Trifunovic9-Sep-08 5:13
Nemanja Trifunovic9-Sep-08 5:13 
GeneralRe: One guidelines for C/C++ programmer Pin
ed welch11-Sep-08 13:02
ed welch11-Sep-08 13:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.