Click here to Skip to main content
15,887,676 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.

 
GeneralRe: Another Cause for LNK1181 Pin
David A. Gray20-Jun-18 7:39
David A. Gray20-Jun-18 7:39 
GeneralRe: Another Cause for LNK1181 Pin
Randor 20-Jun-18 8:31
professional Randor 20-Jun-18 8:31 
GeneralRe: Another Cause for LNK1181 Pin
David A. Gray20-Jun-18 8:39
David A. Gray20-Jun-18 8:39 
GeneralRe: Another Cause for LNK1181 Pin
TheGreatAndPowerfulOz3-Jul-18 9:03
TheGreatAndPowerfulOz3-Jul-18 9:03 
GeneralRe: Another Cause for LNK1181 Pin
Randor 3-Jul-18 10:45
professional Randor 3-Jul-18 10:45 
GeneralRe: Another Cause for LNK1181 Pin
TheGreatAndPowerfulOz3-Jul-18 13:49
TheGreatAndPowerfulOz3-Jul-18 13:49 
GeneralRe: Another Cause for LNK1181 Pin
Marc Clifton20-Jun-18 15:51
mvaMarc Clifton20-Jun-18 15:51 
GeneralRe: Another Cause for LNK1181 Pin
Randor 20-Jun-18 16:54
professional Randor 20-Jun-18 16:54 
Marc Clifton wrote:
Why would there be an option to not produce the .obj file?


Most C/C++ compilers support executing *only* the preprocessor stage before the abstract syntax tree and code generation stages. I typically use it when I need to see how the preprocessor expands my macros. The Microsoft compiler will generate .i files with all of the preprocessor results... macros expanded and included in the file. Both GCC and Clang use the -E switch for accomplishing the same thing.

Here is a simple example of why a software developer might want to only run the preprocessor:

C++
#if DLEVEL > 5  
    #define SIGNAL  1  
    #if STACKUSE == 1  
        #define STACK   200  
    #else  
        #define STACK   100  
    #endif  
#else  
    #define SIGNAL  0  
    #if STACKUSE == 1  
        #define STACK   100  
    #else  
        #define STACK   50  
    #endif  
#endif  
#if DLEVEL == 0  
    #define STACK 0  
#elif DLEVEL == 1  
    #define STACK 100  
#elif DLEVEL > 5  
    #define STACK 50;  
#else  
    #define STACK 200  
#endif


What is the value of STACK? Are you sure? You can expand and debug C macros by running only the preprocessor stage. Can be really useful for complex C macros.

Best Wishes,
-David Delaune
GeneralRe: Another Cause for LNK1181 Pin
David A. Gray21-Jun-18 7:14
David A. Gray21-Jun-18 7:14 
GeneralFreestanding Color Picker Programs Pin
David A. Gray14-Jun-18 11:15
David A. Gray14-Jun-18 11:15 
GeneralRe: Freestanding Color Picker Programs Pin
User 1106097914-Jun-18 12:17
User 1106097914-Jun-18 12:17 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray14-Jun-18 12:25
David A. Gray14-Jun-18 12:25 
GeneralRe: Freestanding Color Picker Programs Pin
User 1106097914-Jun-18 12:31
User 1106097914-Jun-18 12:31 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray14-Jun-18 12:32
David A. Gray14-Jun-18 12:32 
GeneralRe: Freestanding Color Picker Programs Pin
User 1106097914-Jun-18 12:43
User 1106097914-Jun-18 12:43 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray14-Jun-18 12:45
David A. Gray14-Jun-18 12:45 
GeneralRe: Freestanding Color Picker Programs Pin
User 1106097914-Jun-18 12:48
User 1106097914-Jun-18 12:48 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray14-Jun-18 12:50
David A. Gray14-Jun-18 12:50 
GeneralRe: Freestanding Color Picker Programs Pin
User 1106097914-Jun-18 12:59
User 1106097914-Jun-18 12:59 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray14-Jun-18 13:02
David A. Gray14-Jun-18 13:02 
GeneralRe: Freestanding Color Picker Programs Pin
Brisingr Aerowing16-Jun-18 9:15
professionalBrisingr Aerowing16-Jun-18 9:15 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray18-Jun-18 9:41
David A. Gray18-Jun-18 9:41 
GeneralRe: Freestanding Color Picker Programs Pin
David A. Gray25-Jun-18 10:42
David A. Gray25-Jun-18 10:42 
GeneralRe: Freestanding Color Picker Programs Pin
Marc Clifton14-Jun-18 14:23
mvaMarc Clifton14-Jun-18 14:23 
GeneralRe: Freestanding Color Picker Programs Pin
kmoorevs15-Jun-18 4:40
kmoorevs15-Jun-18 4:40 

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.