Click here to Skip to main content
15,914,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDrawing in a Dialog Application Pin
LittleYellowBird23-Jan-03 22:06
LittleYellowBird23-Jan-03 22:06 
GeneralRe: Drawing in a Dialog Application Pin
Zdeslav Vojkovic23-Jan-03 23:34
Zdeslav Vojkovic23-Jan-03 23:34 
GeneralRe: Drawing in a Dialog Application Pin
LittleYellowBird24-Jan-03 2:32
LittleYellowBird24-Jan-03 2:32 
GeneralRemoving F8 key at the beggining Pin
Joan M23-Jan-03 21:53
professionalJoan M23-Jan-03 21:53 
GeneralRe: Removing F8 key at the beggining Pin
Mike Nordell26-Jan-03 2:11
Mike Nordell26-Jan-03 2:11 
GeneralRe: Removing F8 key at the beggining Pin
Joan M26-Jan-03 21:50
professionalJoan M26-Jan-03 21:50 
GeneralHandle IHTMLElement2 events Pin
TianYang23-Jan-03 21:46
TianYang23-Jan-03 21:46 
GeneralStatic arrays and sizeof Pin
Mark Basedow23-Jan-03 21:24
Mark Basedow23-Jan-03 21:24 
Why can't I use sizeof to find the size of a static data array within a class. It works fine if I use sizeof outside the class.

class myclass
{
public:
static char myarray[];

void myfunction()
{
// VC6 compile error: illegal sizeof operand
// GCC 3.2 'sizeof' applied to incomplete type 'char []'
// cout << sizeof (myarray);
}
};

char myclass::myarray[] = "this is a string";

int main(int argc, char* argv[])
{
myclass mc;
cout << sizeof(mc.myarray); // works
//mc.myfunction();
return 0;
}

another alternative I tried was to make the array const but this only works using GCC on linux; using VC6 I get errors.

class myclass2
{
public:
//VC6 error C2258: illegal pure syntax, must be '= 0'
//VC6 error C2252: 'myarray' : pure specifier can only be specified for functions
static const char myarray [] = "this is another string";

void myfunction()
{
cout << sizeof(myarray);
}
};


int main(int argc, char* argv[])
{
myclass2 mc2;

cout << sizeof(mc2.myarray); // works
mc2.myfunction();

return 0;
}

Thanks if anyone can help.
GeneralRe: Static arrays and sizeof Pin
Zdeslav Vojkovic23-Jan-03 23:12
Zdeslav Vojkovic23-Jan-03 23:12 
GeneralThanks Pin
Mark Basedow24-Jan-03 5:56
Mark Basedow24-Jan-03 5:56 
QuestionCHtmlView + CTreeView ?? Pin
mrAndy23-Jan-03 19:54
mrAndy23-Jan-03 19:54 
AnswerRe: CHtmlView + CTreeView ?? Pin
HENDRIK R23-Jan-03 21:38
HENDRIK R23-Jan-03 21:38 
AnswerRe: CHtmlView + CTreeView ?? Pin
jeremysay23-Jan-03 22:21
jeremysay23-Jan-03 22:21 
GeneralRe: application run all the time!!!!!!! Pin
mrAndy23-Jan-03 19:20
mrAndy23-Jan-03 19:20 
GeneralFinally............whew.. Pin
mrAndy23-Jan-03 20:12
mrAndy23-Jan-03 20:12 
Generalforget type something.. Pin
mrAndy23-Jan-03 20:18
mrAndy23-Jan-03 20:18 
GeneralHop counting Pin
Nilesh K.23-Jan-03 18:48
Nilesh K.23-Jan-03 18:48 
GeneralRe: Hop counting Pin
jmkhael23-Jan-03 23:49
jmkhael23-Jan-03 23:49 
GeneralGetting Recent Document History Pin
Effiniti23-Jan-03 17:22
Effiniti23-Jan-03 17:22 
GeneralRe: Getting Recent Document History Pin
jmkhael23-Jan-03 23:54
jmkhael23-Jan-03 23:54 
GeneralRe: Getting Recent Document History Pin
Effiniti27-Jan-03 3:02
Effiniti27-Jan-03 3:02 
GeneralFonts in Chinese Windows Pin
Joe Woodbury23-Jan-03 17:18
professionalJoe Woodbury23-Jan-03 17:18 
GeneralPesty bug - concerns loop initialization Pin
73Zeppelin23-Jan-03 17:13
73Zeppelin23-Jan-03 17:13 
GeneralRe: Pesty bug - concerns loop initialization Pin
73Zeppelin23-Jan-03 17:20
73Zeppelin23-Jan-03 17:20 
GeneralRe: Pesty bug - concerns loop initialization Pin
Michael Dunn23-Jan-03 19:44
sitebuilderMichael Dunn23-Jan-03 19:44 

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.