Project

General

Profile

Feature #2038

Replace `define` with `static const ...` where possible

Added by rhargrave over 4 years ago. Updated over 4 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Enhancement
Target version:
-
Start date:
2015-05-06
% Done:

0%


Description

In working on various bits of doomsday, I noticed that macros are quite often used where constants could be used. I think that it might be an interesting idea to see about replacing as many macros as possible with real constant symbols, as there no longer appears to any need for compatibility with extremely old versions of C. This could make debugging easier (as macros are not included in debugging symbols, whereas constant declarations are), and could vastly increase code quality by eliminating situations like this:

void function(void)
{
#define MACRO value
    code;
    code;
    code;
#undef MACRO
}

History

#1 Updated by rhargrave over 4 years ago

  • Tags set to CodeQuality, Code, Developer

Also available in: Atom PDF