Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

How do I do it in C?

Name: Anonymous 2008-05-09 4:36

Hello /prog/. Imagine I have a struct:

struct foo {
 enum entype { option1, option2 } *bar;
};

"bar" here stands for an array of enums, as you see.
Somewhere in my prog (after correctly allocating needed number of foo`s and bar`s) I have to access Nth bar in foo. I'm currently using this line:

*(enum entype*)(myfoo->bar + sizeof(enum entype)*N) = option1;

Well, it works, but I still think I'm doing it wrong. There must be an easier way, like myfoo->bar[N] or something.

Name: Anonymous 2008-05-09 4:52

>>2 >>3 I wish!

Here's the machine code:

/tmp/ccBC1D3W.s: Assembler messages:
/tmp/ccBC1D3W.s:191: Error: suffix or operands invalid for `call'
/tmp/ccBC1D3W.s:198: Error: suffix or operands invalid for `call'
/tmp/ccBC1D3W.s:204: Error: suffix or operands invalid for `call'

That's what happen when I try myfoo->bar[N].

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List