Hi /prog/, I have some experience with C, but I don't know how to do much except take text input, save variables, calculate, and print text out. What should I read to learn to do things like display graphics, save/load files, send/receive data using ports, et cetera?
Name:
Anonymous2008-12-12 13:22
id.field // access a field of an instance of some struct.
ptr->field // dereference a pointer to struct and access a field of the resulting instance.
How the fuck is it unambiguous? IHBT
Name:
Anonymous2008-12-12 13:24
>>38,40
OH WOW! We're seem to be having a three-way-argument here. We all disagree with each other and you both are wrong.
>>43
I am greatly offended by you calling me dumb. Please apologize immediately or I will resort to leaving this forum.
>>41
You are missing the point. What I am offering is to make . both // access a field of an instance of some struct. and // dereference a pointer to struct and access a field of the resulting instance.. I am claiming that it won't introduce any ambiguity.
>>46
It's semantically ambiguous, like overloading "+" to mean string concatenation.
Name:
Anonymous2008-12-12 18:23
I think the more important question is, why does C have -> in the first place, when the same can be accomplished by dereferencing the pointer and then referencing the member: (*a).b versus a->b. It's much more obvious what it's doing at a glance, and if the operator precedence for such things weren't so screwy it wouldn't even be more characters to type. *a.b reads intuitively from left to right: "dereference the pointer 'a', and access field 'b'".
Name:
Anonymous2008-12-12 18:29
>>37
If redundancy was an issue, we'd all be writing in assembly.
>>53
Then he should have fixed the operator precedence.
Name:
Anonymous2008-12-13 2:07
>>48
It's not it's not it's not ambiguous! Post code where it would be, then we're talking. + is not used for string catenation in C because you can't catenate strings in C. And + is very successfully used in other languages for string catenation.
>>56-58
No, I mean catenate.
Catenate as in ``To connect in a series of ties or links; form into a chain''.
Just like the cat program does.
Name:
Anonymous2008-12-13 3:03
Except that catenate typically refers to the chemistry definition, while concatenate refers to the CS definition. Either way, we have been trolled, or ``WHBT'' as the saying goes.
>>55
If C had a primitive string type, I doubt that "+" would be used for string concatenation, because in C EVERY DISTINCT OPERATION HAS ITS OWN EXCLUSIVE OPERATOR. Except for "-" and "*" wich have two different meanings each, especifically one meaning for the binary version and another for the unary version. But that's because you'd never mistake a binary operator for a unary one, so there's no ambiguity.
Name:
Anonymous2008-12-13 9:50
>>62
Actually a * b; is ambiguous because it can mean either `multiply a by b, then disregard the result' or `declare b as a pointer to type a'.