home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mcsun!sun4nl!wn1.sci.kun.nl!sci.kun.nl!leo
- From: leo@sci.kun.nl (Leo Willems)
- Subject: const * const return value
- Message-ID: <1992Sep7.210827.10793@sci.kun.nl>
- Summary: bad return value for const * const
- Keywords: const pointer
- Sender: news@sci.kun.nl (NUnet News Owner)
- Organization: University of Nijmegen, The Netherlands
- Date: Mon, 7 Sep 1992 21:08:27 GMT
- Lines: 27
-
-
- Is the returntype const char * const legal when it is assigned to a const char*:
-
- const char * const
- f()
- {
- return "aa";
- }
-
- void
- x()
- {
- const char * p = f(); // legal assignment??
-
- ++p; // sigh
- }
-
- cfront 3.0.1 is accepting this, according to me it breaks the meaning
- of a const pointer to const. Is there an explanation?
-
- Please E-mail to leo@atcmp.nl
-
- Thanks.
-
-
- Leo
-
-