Boris Tschirschwitz <[EMAIL PROTECTED]> wrote:
> int *num;
> 
> is customary in C, but for some reason C++ people like to write
> 
> int* num;

The rationale in C is that the variable is delared in the same way it
is invoked. This has it's own internal logic, but becomes a nightmare for
declaring a pointer to a function that returns a pointer to a function,
say.

I think Stroustrop (sp?) was to blame for the attempt to make declarations
look more like C<type-spec variable-name>, but as people have
pointed out, it breaks down as soon as you declare multiple vars.
FWIW, Perl5 has a completely aribtrary mix of the two.

I propose that k&R-ish C<int *num> style gets added to the 'should' list,
with a suggestion that intermediate typedefs should be used to declare
anything partcualarly complex.

And, yes, PDD-9 is going to get revised Real Soon Now. I was going to do
it over the Xmas break, but in the meantime half the world and his dog
decided to spend a few days at my house. I Never knew I had so many friends.
(I know, excuses, excuses.... ;-)

Reply via email to