Hello!!
I have these two statements
"typedef const char *enum_txt[];"
"enum_txt phase_tab =
{"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};"
It's no problem to put the first statement "typedef const char *enum_txt[];"
for example the public section.in the definition of the class but how do I
put
this statement "enum_txt phase_tab =
{"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};"
is the class definition because when I do I get compile error.
//Tony 3 2076
Tony Johansson wrote: Hello!!
I have these two statements "typedef const char *enum_txt[];" "enum_txt phase_tab = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};"
It's no problem to put the first statement "typedef const char *enum_txt[];" for example the public section.in the definition of the class but how do I put this statement "enum_txt phase_tab = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};" is the class definition because when I do I get compile error.
//Tony
Declare them as static member of the class and define while initializing
it outside the class definition.
"Tony Johansson" <jo*****************@telia.com> wrote in message
news:2p*********************@newsc.telia.net... Hello!!
I have these two statements "typedef const char *enum_txt[];" "enum_txt phase_tab = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};"
It's no problem to put the first statement "typedef const char *enum_txt[];" for example the public section.in the definition of the class but how do I put this statement "enum_txt phase_tab = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};" is the class definition because when I do I get compile error.
//Tony
You can't but you don't need to.
I guess you're looking for something like this
class X
{
public:
static const char* const phase_tab[];
};
const char* const X::phase_tab[] =
{"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};
No typedef necessary.
john
John Harrison wrote: "Tony Johansson" <jo*****************@telia.com> wrote in message
I have these two statements "typedef const char *enum_txt[];" "enum_txt phase_tab = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTE RRELEASE","SPACE"};"
You can't but you don't need to.
I guess you're looking for something like this
class X { public: static const char* const phase_tab[]; };
const char* const X::phase_tab[] = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};
No typedef necessary.
john
Oh i see, i didn't notice the typedef is for the definition. Then
actually he can just write
I guess you're looking for something like this
class X
{
public:
static const char* const phase_tab[];
};
typedef const char *enum_txt[];
enum_txt X::phase_tab =
{"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERR ELEASE","SPACE"};
which is more readable This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andrey Tatarinov |
last post by:
Hi.
It would be great to be able to reverse usage/definition parts in
haskell-way with "where" keyword. Since Python 3 would miss lambda, that
would be extremly useful for creating readable...
|
by: John Bailo |
last post by:
The c# *return* statement has been bothering me the past few months.
I don't like the fact that you can have different code paths in a method
and have multiple return statements. To me, it...
|
by: Steven Bethard |
last post by:
The PEP below should be mostly self explanatory. I'll try to keep the
most updated versions available at:
http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
|
by: Steven Bethard |
last post by:
I've updated the PEP based on a number of comments on comp.lang.python.
The most updated versions are still at:
http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
|
by: Steven Bethard |
last post by:
Ok, I finally have a PEP number. Here's the most updated version of the
"make" statement PEP. I'll be posting it shortly to python-dev.
Thanks again for the previous discussion and suggestions!...
|
by: Steven Bethard |
last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The
patch is available at:
http://bugs.python.org/1472459
and I've pasted the full text below.
I've tried to be more explicit about...
|
by: Rui Maciel |
last post by:
I've been delving into finite state machines and at this time it seems that
the best way to implement them is through an intense use of the goto
statement. Yet, everyone plus their granmother is...
|
by: dspfun |
last post by:
Hi!
The words "expression" and "statement" are often used in C99 and C-
textbooks, however, I am not sure of the clear defintion of these
words with respect to C.
Can somebody provide a sharp...
|
by: Danny Shevitz |
last post by:
Howdy,
In my app I need to exec user text that defines a function. I want this
function to unpickle an object. Pickle breaks because it is looking for
the object definition that isn't in the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |