Re: Nit pick -- where to stick the * in a C/C++ definition

Subject: Re: Nit pick -- where to stick the * in a C/C++ definition
From: Arlen -dot- P -dot- Walker -at- jci -dot- com
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Tue, 6 Mar 2001 11:10:03 -0600

>He observes that C programmers tend to prefer the closed right format, but
>the closed left format gives the proper emphasis to someone who is
thinking
>the way you're supposed to think as a C++ programmer. This is not easy to
>explain; it's one of those things that you can only grok through a lot of
>experience with the language, but then it's unmistakable.

Let me have a go:

Note: the "*" in the declarations essentially means "pointer" -- it's where
to find the value, rather than the value itself. The difference between me
and "arlen -dot- p -dot- walker -at- jci -dot- com," essentially.

A C programmer cares mainly about the "type" (integer, floating point,
etc.) of the value, as that is what dictates what he will do with it. The
fact that it is a pointer or and address is, generally speaking, only
incidental to him, hence the C programmer will prefer "int *foo" as the
"int" is the significant part of the declaration, the "*" is less
significant to him. The preferred syntax shows clearly that "*foo"
(pronounced "value at foo") is an integer.

Now, the C++ programmer thinks of everything as an object, which implies
that it has a designated set of operations which can be performed upon it.
She will see "int" and "int *" (or "int*", both pronounced "pointer to
int") as separate objects. As indeed they are -- operations performed upon
"int*" cannot necessarily be performed upon "int" and vice versa. So she
will see the "*" as a part of the object designation, hence "int* foo" --
showing clearly that foo is an instance of class "int*" -- will be her
preferred declaration.

Have fun,
Arlen
Chief Managing Director In Charge, Department of Redundancy Department
DNRC 224

Arlen -dot- P -dot- Walker -at- JCI -dot- Com
----------------------------------------------
In God we trust; all others must provide data.
----------------------------------------------
Opinions expressed are mine and mine alone.
If JCI had an opinion on this, they'd hire someone else to deliver it.


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Develop HTML-Based Help with Macromedia Dreamweaver 4 ($100 STC Discount)
**New Dates!!** San Francisco (Apr 16-17), San Jose (Mar 29-30)
http://www.weisner.com/training/dreamweaver_help.htm or 800-646-9989.

IPCC 01, the IEEE International Professional Communication Conference,
October 24-27, 2001 at historic La Fonda in Santa Fe, New Mexico, USA.
CALL FOR PAPERS OPEN UNTIL MARCH 15. http://ieeepcs.org/2001/

---
You are currently subscribed to techwr-l as: archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit
http://www.raycomm.com/techwhirl/ for more resources and info.


Previous by Author: Fireworks training recommendation?
Next by Author: Re: Lumberg! (was Ruffled Feathers)
Previous by Thread: Re: Nit pick -- where to stick the * in a C/C++ definition
Next by Thread: Help with HTML Transit


What this post helpful? Share it with friends and colleagues:


Sponsored Ads