Welcome! Log In Create A New Profile

Advanced

Marlin ifdef/endif - ifndef/endif statements

Posted by rcjoseb 
Marlin ifdef/endif - ifndef/endif statements
January 26, 2015 03:08PM
Are some of the ifdef/endif - ifndef/endif statements in the Marlin firmware really needed? For example, I know that my motherboard is defined somewhere and that I am going to set it as 33. I develop software in VB .NET and I know that if something is there, I really don't need an If Then statement. But this is kind of like C## which freaks me out :-)

Instead of:

#ifndef MOTHERBOARD
#define MOTHERBOARD 33
#endif

Can't I just have

#define MOTHERBOARD 33


Thanks,

Jose

Edited 1 time(s). Last edit at 01/26/2015 03:37PM by rcjoseb.
Re: Marlin ifdef/endif - ifndef/endif statements
January 27, 2015 01:29AM
I've thought about the same thing, and about how much it would be able to strip Marlin for like the smartrap - not because it would make any performance difference, but because it would be easier to read and make changes for the end user.
Re: Marlin ifdef/endif - ifndef/endif statements
January 27, 2015 01:33AM
I am working on doing that now with the config.h file but am getting compile errors. Once i have it all figured out I will post it here.
Re: Marlin ifdef/endif - ifndef/endif statements
January 27, 2015 09:33AM
I'm looking forward to it smiling smiley
Re: Marlin ifdef/endif - ifndef/endif statements
March 08, 2017 03:05PM
#ifndef checks whether the given token has been #defined earlier in the file or in an included file; if not, it includes the code between it and the closing #else or, if no #else is present, #endif statement.
Sorry, only registered users may post in this forum.

Click here to login