Author's Note: How would you synthesize the way your company works in C ? I tried to do it and the result is the program below. Any fellow programmer should find some bitter humour in the code, but the real fun comes when you compile it with Borland C++ 5.0. Enjoy matching the diagnostics and the relative lines of code. The sad part is, I think the program is portable to many (all?) companies. ===================== CODE STARTS HERE ============================= 01 02 #define PRODUCT_READY 0 03 #define MORE_THAN_20_DAYS 0 04 #define LESS_THAN_20_DAYS 1 05 #define CallExpensiveConsultants() 06 07 typedef int Pseudo; 08 09 static void Analysis_and_Design( ); 10 Pseudo ProductDevelopment( int resources[] ); 11 12 int meetings = 9999; 13 14 int main() 15 { 16 int MyCompany, WorksSeriously = 2; 17 int resources[0]; 18 19 meetings + meetings; 20 21 if(MyCompany = WorksSeriously) 22 return ProductDevelopment( resources ); 23 return 0; 24 } 25 26 Pseudo ProductDevelopment( int *resources ) 27 { 28 int CommonSense, Brain; 29 unsigned int TROUBLES = 1; 30 int Time = 0, DaysToShippingDate = Time - 1; 31 32 while( TROUBLES >= 0 ) 33 { 34 switch( DaysToShippingDate ) 35 { 36 case MORE_THAN_20_DAYS: break; 37 case LESS_THAN_20_DAYS: resources -= 5; break; 38 default CallExpensiveConsultants(); break; 39 } 40 41 meetings, meetings; 42 --resources; 43 --Time; 44 TROUBLES *= TROUBLES; 45 } 46 return PRODUCT_READY; 47 } 48 49 static void Analysis_and_Design() 50 { 51 } 52 ===================== CODE ENDS HERE ============================= This is BC 5.0's output: (I just pruned out a couple of redundant messages) Info :Compiling D:\mycomp.c Error:mycomp.c(17,22):Array must have at least one element Warn :mycomp.c(19,16):Code has no effect Warn :mycomp.c(21,22):Possibly incorrect assignment Warn :mycomp.c(32,24):Condition is always true Error:mycomp.c(38,45):Incorrect use of default Warn :mycomp.c(41,18):Code has no effect Warn :mycomp.c(46,12):Unreachable code Warn :mycomp.c(47,8):'Brain' is declared but never used Warn :mycomp.c(47,8):'CommonSense' is declared but never used And if you tried to lint it, you could even get something like Warning: prova.c line 52 static function 'Analysys_and_Design()' is never called |
| Home | Main | Misc. | Links | Email |