Is it bad that I'm starting to think that struct
s look pretty? At least that's better than thinking them tasty, right?
Saturday, April 9, 2005
Mmm, structs...
Posted by Arthaey Angosii at 11:26 AM 5 comments
Subscribe to:
Post Comments (Atom)
5 comments:
As long as you don't go into the realm of structS being "sexy"
Umm... what are structS? *g*
But they're so much less pretty in C than in C#... C's structs seem like cheap whores in comparison.
Joe: Structs, sexy? That's just sick.
Forrest: No, no. See, C structs are simple and thus have a certain clean elegance to them. C++ are more useful and fancy, but not as pretty. Like 26. Very pretty number. See? ;)
Loodle: Ah, poor non-programmer. You can think of a struct as a little bundle of related information. For example, you could have a "person" struct that bundles together, say, name and age:
struct person {
string name; /* programmers: it's typedef'd, go away */
int age; /* "int" is short for "integer" */
}
Then, elsewhere in the program's code, I could create a person struct and get its bundled information back out of it:
struct person someone = {"Arthaey", 21};
display(someone.name); /* displays "Arthaey" */
display(someone.age); /* displays 21 */
Even you could do this! It's easier than zMud scripting, maybe. :)
C#'s structs tho, can be just as simple, but they let you do so much more if you like. There is that little bit of rtti but i think that's justifiable.
Post a Comment