home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
- 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
-