🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #126

Re: const and template parameters

#126
From: checker
Date: Tue, 18 Aug 1992 16:25
25 lines
1018 bytes
vinoski@apollo.hp.com (Stephen Vinoski) writes:
>	void tfunc(int *const arg);
>with the argument actually being a const pointer to int.
>The latter interpretation is exactly the same as the "const applied to
>typedef" problem:
>	typedef int *IntPtr;
>	const IntPtr int_ptr;
>Here, int_ptr is a const pointer to int (sometimes much to the
>amazement of C++ novices :-)).

The `solution' is to write your declarations like this:

simple-type-name type-specifiers

that means

int const foo;
instead of
const int foo;

The only disadvantage of doing it this way is that hardly anybody does.
I find it much clearer, especially when you get into complicated
declarations.

Chris
Technical Details
Message-ID: <1889@acf5.NYU.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!cmcl2!acf5!checker
References: <Bt5ECn.CtF@apollo.hp.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!cmcl2!acf5!checker
From: checker@acf5.NYU.EDU (checker)
Newsgroups: comp.std.c++
Subject: Re: const and template parameters
Message-ID: <1889@acf5.NYU.EDU>
Date: 18 Aug 92 16:25:20 GMT
References: <Bt5ECn.CtF@apollo.hp.com>
Organization: New York University
Lines: 25