Click here to Skip to main content
11,647,748 members (62,186 online)

C / C++ / MFC

 
AnswerRe: how to lock function? Pin
Richard MacCutchan16-Sep-13 20:41
mvpRichard MacCutchan16-Sep-13 20:41 
AnswerRe: how to lock function? Pin
CPallini16-Sep-13 21:18
mvpCPallini16-Sep-13 21:18 
AnswerRe: how to lock function? Pin
Freak3016-Sep-13 22:06
memberFreak3016-Sep-13 22:06 
GeneralRe: how to lock function? Pin
pasztorpisti17-Sep-13 0:27
memberpasztorpisti17-Sep-13 0:27 
QuestionWhat does it mean when...... Pin
Richard Andrew x6416-Sep-13 10:42
professionalRichard Andrew x6416-Sep-13 10:42 
AnswerRe: What does it mean when...... Pin
Graham Breach16-Sep-13 11:26
memberGraham Breach16-Sep-13 11:26 
GeneralRe: What does it mean when...... Pin
Richard Andrew x6416-Sep-13 11:51
professionalRichard Andrew x6416-Sep-13 11:51 
QuestionFeedback appreciated Pin
_Psychopomp_16-Sep-13 0:15
professional_Psychopomp_16-Sep-13 0:15 
AnswerRe: Feedback appreciated Pin
pasztorpisti16-Sep-13 0:54
memberpasztorpisti16-Sep-13 0:54 
AnswerRe: Feedback appreciated Pin
Richard MacCutchan16-Sep-13 0:54
mvpRichard MacCutchan16-Sep-13 0:54 
AnswerRe: Feedback appreciated - OT Pin
Richard MacCutchan16-Sep-13 20:39
mvpRichard MacCutchan16-Sep-13 20:39 
GeneralRe: Feedback appreciated - OT Pin
SoMad16-Sep-13 21:23
professionalSoMad16-Sep-13 21:23 
GeneralRe: Feedback appreciated - OT Pin
_Psychopomp_16-Sep-13 21:59
professional_Psychopomp_16-Sep-13 21:59 
AnswerRe: Feedback appreciated Pin
Stefan_Lang17-Sep-13 1:42
memberStefan_Lang17-Sep-13 1:42 
He's definitely right in that the style of code you provided is not in any way a good example of nodern, object-oriented code. Defining a struct that contains nothing but two constants is not a sensible design. Definitely not from an object-oriented view, and not even in for modular, old style C programming. For the former you'd define a boundary object singleton with methods that you could call rather than exposing the actual constants, for the latter there's no good reason not to simply use a number of individual constants - but you could also just define a function to validate the boundary range and thus hide the use of the constants inside the function implementation!

I've listed these suggestions and a few more in the other thread. (didn't even use templates - not that there wouldn't be good solutions with templates too, but there really is no need to overcomplicate things!)

Also, if you want to make a point, choose an example that is bad for non-obvious reasons. Your use of #define as a bad example totally fails to bring across the need for a const struct initialization. And to be honest, I still don't see the need in the first place, since - as outlined above - grouping the const values inside a struct was a mistake to start with.

On a sidenote, you are contradicting yourself in this article: Your reason for not using #define is that you have to recompile every time the value changes - but the same is true for every variant you bring up in the article! The only way to avoid having to recompile the code is store the values outside the code and read them at some point (which however would prevent the use of const variables...)
AnswerRe: Feedback appreciated Pin
Vaclav_Sal17-Sep-13 10:21
memberVaclav_Sal17-Sep-13 10:21 
Questiondebug begining: Unhandled exception at 0x77cf15de in blast_vib_proc.exe: 0xC00000FD: Stack overflow. Pin
mrby12314-Sep-13 16:18
membermrby12314-Sep-13 16:18 
SuggestionRe: debug begining: Unhandled exception at 0x77cf15de in blast_vib_proc.exe: 0xC00000FD: Stack overflow. Pin
Richard MacCutchan14-Sep-13 21:42
mvpRichard MacCutchan14-Sep-13 21:42 
AnswerRe: debug begining: Unhandled exception at 0x77cf15de in blast_vib_proc.exe: 0xC00000FD: Stack overflow. Pin
_Psychopomp_15-Sep-13 10:39
professional_Psychopomp_15-Sep-13 10:39 
Questionas soon as start program got error message - stack overflow Pin
mrby12313-Sep-13 19:35
membermrby12313-Sep-13 19:35 
AnswerRe: as soon as start program got error message - stack overflow Pin
Richard MacCutchan13-Sep-13 22:26
mvpRichard MacCutchan13-Sep-13 22:26 
GeneralRe: as soon as start program got error message - stack overflow Pin
CPallini14-Sep-13 6:45
mvpCPallini14-Sep-13 6:45 
AnswerRe: as soon as start program got error message - stack overflow Pin
Jochen Arndt13-Sep-13 22:32
professionalJochen Arndt13-Sep-13 22:32 
AnswerRe: as soon as start program got error message - stack overflow Pin
Erudite_Eric14-Sep-13 21:39
memberErudite_Eric14-Sep-13 21:39 
SuggestionGetting forward from console applications to gui Pin
Farhan_Karim13-Sep-13 3:10
memberFarhan_Karim13-Sep-13 3:10 
GeneralRe: Getting forward from console applications to gui Pin
Richard MacCutchan13-Sep-13 3:44
mvpRichard MacCutchan13-Sep-13 3:44 
GeneralRe: Getting forward from console applications to gui Pin
Farhan_Karim13-Sep-13 8:09
memberFarhan_Karim13-Sep-13 8:09 
GeneralRe: Getting forward from console applications to gui Pin
jschell13-Sep-13 11:36
memberjschell13-Sep-13 11:36 
AnswerRe: Getting forward from console applications to gui Pin
_Psychopomp_15-Sep-13 10:41
professional_Psychopomp_15-Sep-13 10:41 
QuestionProblem with const struct initialization in a class Pin
_Psychopomp_13-Sep-13 2:47
professional_Psychopomp_13-Sep-13 2:47 
QuestionRe: Problem with const struct initialization in a class Pin
DavidCrow13-Sep-13 9:52
memberDavidCrow13-Sep-13 9:52 
AnswerRe: Problem with const struct initialization in a class Pin
_Psychopomp_13-Sep-13 10:02
professional_Psychopomp_13-Sep-13 10:02 
AnswerRe: Problem with const struct initialization in a class Pin
Kosta Cherry13-Sep-13 16:17
memberKosta Cherry13-Sep-13 16:17 
AnswerRe: Problem with const struct initialization in a class Pin
Erudite_Eric14-Sep-13 21:43
memberErudite_Eric14-Sep-13 21:43 
AnswerRe: Problem with const struct initialization in a class Pin
_Psychopomp_15-Sep-13 10:35
professional_Psychopomp_15-Sep-13 10:35 
AnswerRe: Problem with const struct initialization in a class Pin
Stefan_Lang17-Sep-13 0:34
memberStefan_Lang17-Sep-13 0:34 
Questionlistview with tooltip Pin
JoneLe8612-Sep-13 18:16
memberJoneLe8612-Sep-13 18:16 
AnswerRe: listview with tooltip Pin
Richard MacCutchan13-Sep-13 3:35
mvpRichard MacCutchan13-Sep-13 3:35 
Questiongetting pointer to document from OnGetTabToolTip in MDI tabbed app Pin
Member 258447412-Sep-13 6:41
memberMember 258447412-Sep-13 6:41 
SuggestionRe: getting pointer to document from OnGetTabToolTip in MDI tabbed app Pin
DavidCrow12-Sep-13 16:10
memberDavidCrow12-Sep-13 16:10 
GeneralRe: getting pointer to document from OnGetTabToolTip in MDI tabbed app Pin
Member 258447412-Sep-13 18:01
memberMember 258447412-Sep-13 18:01 
GeneralRe: getting pointer to document from OnGetTabToolTip in MDI tabbed app Pin
Member 258447412-Sep-13 18:04
memberMember 258447412-Sep-13 18:04 
AnswerRe: getting pointer to document from OnGetTabToolTip in MDI tabbed app Pin
jeron113-Sep-13 5:20
memberjeron113-Sep-13 5:20 
GeneralRe: getting pointer to document from OnGetTabToolTip in MDI tabbed app Pin
Member 258447413-Sep-13 7:39
memberMember 258447413-Sep-13 7:39 
QuestionResizing Controls and Texts Pin
Don Guy11-Sep-13 14:00
memberDon Guy11-Sep-13 14:00 
AnswerRe: Resizing Controls and Texts Pin
digitalspace.xjtu11-Sep-13 15:02
memberdigitalspace.xjtu11-Sep-13 15:02 
AnswerRe: Resizing Controls and Texts Pin
SoMad11-Sep-13 17:16
professionalSoMad11-Sep-13 17:16 
QuestionWhat is doscreatemutexsem Pin
Carl Cioffi11-Sep-13 9:57
memberCarl Cioffi11-Sep-13 9:57 
QuestionRe: What is doscreatemutexsem Pin
DavidCrow11-Sep-13 10:33
memberDavidCrow11-Sep-13 10:33 
AnswerRe: What is doscreatemutexsem Pin
Carl Cioffi12-Sep-13 3:20
memberCarl Cioffi12-Sep-13 3:20 
GeneralRe: What is doscreatemutexsem Pin
DavidCrow12-Sep-13 3:36
memberDavidCrow12-Sep-13 3:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.150804.4 | Last Updated 4 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid