Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: C++ variable names
Date: Tue, 21 Jan 2020 05:31:54 -0800
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <86lfq1hr5h.fsf@linuxsc.com>
References: <4d6f2d19-ff6f-433c-bff9-adde1c8b719a@googlegroups.com> <2a3d69e3-50c6-45df-94ce-cd23723c158a@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="d01dc2e4789bccc98e4eaed72337c14b"; logging-data="23925"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19aaKI5aJniWL3xMLaiAsj7RiDzCp8nZeY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:k956HqDYnuL8IhujB/yHnX9w1gY= sha1:fVRN5qm1eB0pbEPBqj6Tp2R9VaY=
Xref: csiph.com comp.lang.c++:71486
Manfred writes:
> On 1/16/2020 11:11 PM, <> Tiib wrote:
>
>> On Thursday, 16 January 2020 23:48:52 UTC+2, Lynn McGuire wrote:
>>
>>> On 1/15/2020 8:42 PM, Daniel wrote:
>>>
>>>> On Wednesday, January 15, 2020 at 9:32:02 PM UTC-5, T wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> Would some kind individual please fill in
>>>>> the C++ variables names that go with these
>>>>> C variable names?
>>>>>
>>>>> int8_t in C
>>>>
>>>> ...
>>>>
>>>>> Do I just drop the "_t"?
>>>>
>>>> In general it's considered to be bad practice to adorn a variable name
>>>> with type information.
>>>
>>> Huh ? Don't tell that to Hungarian notation folks.
>>> https://en.wikipedia.org/wiki/Hungarian_notation
>>
>> Yes, but the Hungarian notation guys are frowned upon in majority of
>> collectives. By
>>
>> Bjarne Stroustrup does not recommend it.
>> It can be tricky for three star programmer to understand what they
>> do without such notation OTOH it is unclear if it does help.
>>
>
> Note that, as far as I read somewhere, the Hungarian notation was
> initially introduced to indicate the "intention or kind" of a variable
> or function, which is not that silly of an idea - in fact you always
> use the variable name to indicate its purpose, the Hungarian
> decoration introduced some kind of naming convention with this
> respect.
In languages with static typing, type names can (and IMO should)
be used to indicate the purpose of identifiers declared with
those type names. Redundantly adding type or purpose information
to an identifier name is, well, redundant.
These comments don't apply to the orginal context (BCPL) of
Hungarian notation, since BCPL doesn't have any notion of
static typing.
> For example, I read it was initially used to identify the coordinate
> system some point would belong to (page, print margins, ...) in MS
> Office applications.
Hungarian notation predates Microsoft as a company, let alone
Microsoft word. It may be the case the Hungarian notation was
used to indicate a coordinate value (as opposed to, say, a string
length), but it was certainly not initially in any Microsoft
product.