Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGood ol static member inits Pin
Eytukan21-Mar-09 21:45
Eytukan21-Mar-09 21:45 
AnswerRe: Good ol static member inits Pin
Gary R. Wheeler21-Mar-09 22:26
Gary R. Wheeler21-Mar-09 22:26 
GeneralRe: Good ol static member inits Pin
Eytukan21-Mar-09 22:59
Eytukan21-Mar-09 22:59 
GeneralRe: Good ol static member inits Pin
Gary R. Wheeler21-Mar-09 23:28
Gary R. Wheeler21-Mar-09 23:28 
GeneralRe: Good ol static member inits Pin
Eytukan21-Mar-09 23:44
Eytukan21-Mar-09 23:44 
GeneralRe: Good ol static member inits Pin
Gary R. Wheeler21-Mar-09 23:58
Gary R. Wheeler21-Mar-09 23:58 
GeneralRe: Good ol static member inits Pin
Eytukan22-Mar-09 0:05
Eytukan22-Mar-09 0:05 
GeneralRe: Good ol static member inits Pin
Stuart Dootson23-Mar-09 0:31
professionalStuart Dootson23-Mar-09 0:31 
VuNic wrote:
The above won't work without we initializing it again in the .cpp.


You aren't (just) initializing it - you are defining (i.e. reserving storage for) it.

If you could define (as in reserve storage for) the static item in the class definition, then where would the static item's storage live? Each .cpp file that included the header with the class definition would contain storage for the item. You would need some intelligence in the linker to merge all allocations of the static item. Now, that intelligence might exist today, but it sure didn't back when Bjarne designed C++.

I suspect the Annotated C++ Reference[^] might well provide insight into these design decisions. I have got and have read that book, but not for a while.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Good ol static member inits Pin
Eytukan23-Mar-09 2:23
Eytukan23-Mar-09 2:23 
AnswerRe: Good ol static member inits Pin
cmk22-Mar-09 10:28
cmk22-Mar-09 10:28 
GeneralRe: Good ol static member inits Pin
Eytukan22-Mar-09 18:01
Eytukan22-Mar-09 18:01 
GeneralRe: Good ol static member inits Pin
cmk22-Mar-09 20:35
cmk22-Mar-09 20:35 
GeneralRe: Good ol static member inits Pin
Eytukan23-Mar-09 2:29
Eytukan23-Mar-09 2:29 
AnswerRe: Good ol static member inits Pin
Niklas L23-Mar-09 1:55
Niklas L23-Mar-09 1:55 
GeneralRe: Good ol static member inits Pin
Eytukan23-Mar-09 2:35
Eytukan23-Mar-09 2:35 
QuestionNeed a AVC/H.264 Video Decoder Pin
Andy Rama21-Mar-09 21:10
Andy Rama21-Mar-09 21:10 
AnswerRe: Need a AVC/H.264 Video Decoder Pin
Michael Schubert22-Mar-09 1:20
Michael Schubert22-Mar-09 1:20 
GeneralRe: Need a AVC/H.264 Video Decoder Pin
Andy Rama22-Mar-09 20:26
Andy Rama22-Mar-09 20:26 
GeneralRe: Need a AVC/H.264 Video Decoder Pin
Andy Rama22-Mar-09 20:50
Andy Rama22-Mar-09 20:50 
GeneralRe: Need a AVC/H.264 Video Decoder Pin
Michael Schubert22-Mar-09 21:14
Michael Schubert22-Mar-09 21:14 
QuestionRe: Need a AVC/H.264 Video Decoder Pin
Andy Rama23-Mar-09 3:33
Andy Rama23-Mar-09 3:33 
QuestionA default MFC project don't use /Yc compiler option, how does it work? [modified] Pin
followait21-Mar-09 16:33
followait21-Mar-09 16:33 
AnswerRe: A default MFC project don't use /Yc compiler option, how does it work? Pin
Stuart Dootson23-Mar-09 0:39
professionalStuart Dootson23-Mar-09 0:39 
QuestionTimer or For Loop Help. Pin
FISH78621-Mar-09 13:36
FISH78621-Mar-09 13:36 
AnswerRe: Timer or For Loop Help. Pin
Code-o-mat21-Mar-09 23:42
Code-o-mat21-Mar-09 23:42 

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.