Request for Comments: Aggregate Assignment in C ...

Heidi de Wet heidi at ctk1.UUCP
Sat Dec 15 00:09:16 AEST 1990


In <4479 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>In article <77546 at iuvax.cs.indiana.edu>, mayer at iuvax.cs.indiana.edu (Mayer Goldberg) writes:
>> [Proposed alternative to 'with' construct]
>> We submit that a better way of doing this would be to allow a
>> kind of assignment that we allow during initialization.
>> Something like:
>> my_vec = {4,, 7};

As a staunch fan of Pascal, writing C for a living :-), this seems a
very uninteresting problem.  Pascal's 'with' doesn't solve this, anyway.
It _does_ reduce the text associated with multiple references to the
same record structure in one expression.  Try this for size:

   (*Buff)->Msg_Bytes [(*Buff)->Start_Index + (*Buff)->Byte_Count] = B;

Now try copying one 'Buff' to another...  Any suggestions about this?

If you want to make assignments of multiple elements in a structure
easier, how about the construct 'A = B', where A and B are identical,
complex structs or arrays?  Yes, you can use memcpy, but it would be
nice to see the compiler doing a _little_ bit of work for a change.


>If you want Ada, you know where to find it.
>It you want to make it easy for people to introduce subtle and
>difficult-to-locate mistakes in their programs, keep it up.

Well, that would be entirely in the spirit of C, wouldn't it?

--------------------
Heidi de Wet
University of Cape Town, South Africa
ddsw1!proxima!ctk1!heidi -or- proxima!ctk1!heidi at ddsw1.mcs.com



More information about the Comp.lang.c mailing list