Puzzling sample code

Hey all,
Just starting to play around with BeOS… d/l BeOS PE MAX v3.1 Beta 1, and noticed that this was one of the best forums, in terms of activity. I thought I’d post a question since there seems to be some very knowledgeable people here.

In the sample code, BasicButton, there is a string literal that is defined in one of the header files:

#define BUTTON_MSG ‘PRES’

This string literal gets used in the constructor of a BMessage object, which in turn is used in the constructor of a BButton object.

What I’m scratching my head about is that I’ve never seen string literals in C/C++ use single quotations. I was thinking that this is illegal. I notice that the sample code compiles and runs with seemingly no problem. Can someone clarify what the heck is going on?

Thanks!
Sherpa78

D’OH! I’m an idiot. The string literal is 4 letters long. Each letter is an 8-byte character. 4 of them create an uint32 value.

Sorry for the brain fart. It just threw me for a loop because I had never seen it done like that before… kind of a cool idea, really. :slight_smile: