← Back to team overview

kicad-developers team mailing list archive

Re: Bugfix for plotting


--- In kicad-devel@xxxxxxxxxxxxxxx, Manveru <manveru@...> wrote:
> But, you should always avoid the following:
> int *ptr, val;

For 'plain' types it is often useful, expecially when doing system work (I'm talking about C, not C++, of course).

But anyway the * is tied to the name, not to the type :P this is aggravatedby the columning, so that

int *a;

is way more pointerish than

int* a;
(of course, that's a personal way of thinking :D)

But I found that usually a structured type is used as a pointer OR as an instance... 

> The way how pointers are marked in C is somewhat confusing, in other hand
> the same operator marks pointer declaration and pointer dereference - that
> seemed logical to language authors.

Uhm... it is so in most languages with pointers since Pascal, IIRC... but in pascal ^ (its equivalent for *, at the time it was an actual up-arrow!) is attached to the TYPE. Well MOST languages, I'll spare you the COBOL pointer syntax (it is something containing ADDRESS-OF and a lot of other things... you need it to call the asm routine to convert from EBCDIC to ASCII and back. Yes, in 2009 :D:D)

WAY more confusing is perl where pointer as normal scalars and there are LOT of ways to dereference them (what isn't confusing in perl?)

> I saw advice to declare only one variable at a time in many places, so
> programmer should avoid constructs like:
> int a,b,c;
> But lot of people argues that such style creates lot of source code lines
> and takes too much time to type.

Please, we only have 24 lines of screen! Well, no, more like 28, on my box... coupled with the policy of the braces on their own lines you need to page a lot around just to see the outline! (as in COBOL :D only global vars, one var for line and every 'struct' has to be declared exploded). Uhm... I could pay for a 'with' statement in C!

OTOH maybe that's the reason for ^Y in vim :D (in insert mode copies the character right on the above line)