Request for Comments: Aggregate Assignment in C ...

Mark A Terribile mat at mole-end.UUCP
Sun Dec 23 13:00:21 AEST 1990


In article <538 at taumet.com>, steve at taumet.com (Stephen Clamage) writes:
> mayer at iuvax.cs.indiana.edu (Mayer Goldberg) writes:

> |Pascal programmers who learn C, frequently complain of C's
> |lack of a "with" construct. We propose an alternative to
> |adding such a keyword, ...

> |[example]
> |struct ag {
> |  int a, b, c;
> |};
> |struct ag my_vec = {1, 2, 3};


> You could just use C++, which already allows such things via constructors.


Note also that C++ has much less use for the `with' because sequences of
`` abc. ... '' and `` def-> ... '' tend to be absorbed into member functions
where they are not written when the function is called on behalf of the
structure object.

On the other hand, if someone is uncomfortable with C because he's just come
from another environment (such as one which will remain nameless except that
it's named after a fellow name Blaise Pascal, who did nothing at all to
deserve it) sending him to C++ is the LAST thing you want to do.  First,
because C++ has even a stronger flavor than C.  Second, because someone who
realizes that it's possible to do almost ANYTHING in C++, without learning
the C mindset as a stepping stone is liable to try some strange things.  They
might not work, but we can't count on it.
-- 

 (This man's opinions are his own.)
 From mole-end				Mark Terribile



More information about the Comp.lang.c mailing list