Click here to Skip to main content
15,892,517 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Program for decrypting graphic files in C. Pin
TheDefenestrator18-Oct-14 13:36
TheDefenestrator18-Oct-14 13:36 
AnswerRe: Program for decrypting graphic files in C. Pin
Richard Andrew x6418-Oct-14 15:17
professionalRichard Andrew x6418-Oct-14 15:17 
GeneralRe: Program for decrypting graphic files in C. Pin
TheDefenestrator18-Oct-14 15:20
TheDefenestrator18-Oct-14 15:20 
GeneralRe: Program for decrypting graphic files in C. Pin
Richard Andrew x6418-Oct-14 15:26
professionalRichard Andrew x6418-Oct-14 15:26 
GeneralRe: Program for decrypting graphic files in C. Pin
TheDefenestrator22-Oct-14 5:46
TheDefenestrator22-Oct-14 5:46 
GeneralRe: Program for decrypting graphic files in C. Pin
Richard Andrew x6422-Oct-14 8:00
professionalRichard Andrew x6422-Oct-14 8:00 
Question#define VERSION 1.0.0 - too many decimal points Pin
Vaclav_16-Oct-14 4:12
Vaclav_16-Oct-14 4:12 
AnswerRe: #define VERSION 1.0.0 - too many decimal points Pin
Stefan_Lang16-Oct-14 4:35
Stefan_Lang16-Oct-14 4:35 
If it's used as a string, then why don't you #define it as a string? If you don't know how to correctly use #define, why do you use it at all? It's bad style anyway! Make it a const string instead:

C++
const std::string VERSION = "1.0.0";


There. Works every time. And if the compiler complains, the code that uses it is wrong! That is the advantage of using const instead of #define: the compiler will notify you of usage problems, whereas in case of #define there's no guarantee the compiler will catch a glitch, and if it does, it will likely not point to the right position in your code.

Vaclav_Sal wrote:
PS What is the correct name for "the stuff" after #define and VERSION?

The correct name is "clutter", or more to the point: "stuff that clogs your global namespace". #define symbols have a nasty habit of colliding with variable and function names elsewhere because they pollute the entire global namespace. Just don't use it!
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
PIEBALDconsult16-Oct-14 7:59
mvePIEBALDconsult16-Oct-14 7:59 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
CPallini16-Oct-14 9:17
mveCPallini16-Oct-14 9:17 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
PIEBALDconsult16-Oct-14 9:22
mvePIEBALDconsult16-Oct-14 9:22 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
CPallini16-Oct-14 9:45
mveCPallini16-Oct-14 9:45 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
Stefan_Lang17-Oct-14 3:08
Stefan_Lang17-Oct-14 3:08 
AnswerRe: #define VERSION 1.0.0 - too many decimal points Pin
PIEBALDconsult16-Oct-14 4:58
mvePIEBALDconsult16-Oct-14 4:58 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
Vaclav_16-Oct-14 6:17
Vaclav_16-Oct-14 6:17 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
PIEBALDconsult16-Oct-14 7:27
mvePIEBALDconsult16-Oct-14 7:27 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
Albert Holguin16-Oct-14 12:33
professionalAlbert Holguin16-Oct-14 12:33 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
CPallini16-Oct-14 9:14
mveCPallini16-Oct-14 9:14 
AnswerRe: #define VERSION 1.0.0 - too many decimal points Pin
Richard MacCutchan16-Oct-14 6:27
mveRichard MacCutchan16-Oct-14 6:27 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
PIEBALDconsult16-Oct-14 7:29
mvePIEBALDconsult16-Oct-14 7:29 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
Richard MacCutchan16-Oct-14 22:14
mveRichard MacCutchan16-Oct-14 22:14 
GeneralRe: #define VERSION 1.0.0 - too many decimal points Pin
PIEBALDconsult17-Oct-14 5:03
mvePIEBALDconsult17-Oct-14 5:03 
GeneralSOLVED Re: #define VERSION 1.0.0 - too many decimal points Pin
Vaclav_16-Oct-14 7:32
Vaclav_16-Oct-14 7:32 
Questionwhich tool can be used develop c++ code i.e visual studio or unix Pin
Member 1112317113-Oct-14 9:30
Member 1112317113-Oct-14 9:30 
AnswerRe: which tool can be used develop c++ code i.e visual studio or unix Pin
Richard MacCutchan13-Oct-14 21:10
mveRichard MacCutchan13-Oct-14 21:10 

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.