TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
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.
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.