Ich lerne C++ zu formatieren, damit es am saubersten ist und ich kann nichts herausfinden.Korrektes Speichern von funktionspezifischen const Optionen/Variablen?
Wie speichere ich funktionsspezifische konstante Variablen? Ich habe die folgenden zwei Ideen:
Meine erste Idee:
innen CPP:
// ---------------------------------------------------------
// Purpose: Drawing the menu background.
// ---------------------------------------------------------
inline void DrawBackground() {
static int BeginWidth = 80;
static int EndWidth = 590;
//usage of the BeginWidth and EndWidth
}
Meine zweite Idee:
innen .h:
const int BeginWidth = 80;
const int EndWidth = 590;
CPP:
// ---------------------------------------------------------
// Purpose: Drawing the menu background.
// ---------------------------------------------------------
inline void DrawBackground() {
//usage of the BeginWidth and EndWidth
}
ist eine dieser Ideen richtig? In dem Fall, dass beide korrekt sind, wird einer für angemessener gehalten?