From -8037388869615741836
X-Google-Thread: f78e5,1d1109cd86668825
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news3.google.com!news.glorb.com!peer1.news.newnet.co.uk!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: hozwirk.SPAM@arcor.de ("Heinz Ozwirk")
Newsgroups: comp.std.c++
Subject: Re: strtol const-ness problem
Date: Mon, 14 Aug 2006 23:49:08 GMT
Organization: Arcor
Lines: 32
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <44e105b4$0$10155$9b4e6d93@newsspool2.arcor-online.net>
References: <1155392893.026182.121030@h48g2000cwc.googlegroups.com>   <1155445528.956928.185450@p79g2000cwp.googlegroups.com> <1155587670.517846.8770@h48g2000cwc.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1155599356 14064 158.152.254.254 (14 Aug 2006 23:49:16 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 14 Aug 2006 23:49:16 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-Priority: 3
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-MSMail-Priority: Normal
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.6+Sun/8.13.6/Submit) id k7ENn8ws008434;
	Tue, 15 Aug 2006 09:49:08 +1000 (EST)
X-NNTP-Posting-Date: 15 Aug 2006 01:22:28 CEST
X-Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:3260

"Manfred von Willich" <manfred@techniroot.co.za> schrieb im Newsbeitrag 
news:1155587670.517846.8770@h48g2000cwc.googlegroups.com...
> A const-correct library would have had the signature:
>
>   long strtol (const char *nptr, const char **endptr, int base);
>
> However, given that a function may wish to scan and then modify data
> from the point scanned to (I expect this use to be far less common),
> the following additional signature would have been appropriate:
>
>   long strtol (char *nptr, char **endptr, int base);
>
> In C++, two signatures would have been fine.  Given that the signature
> is in <stdlib.h>, the linkage is extern"C", an overloaded signature is
> precluded.  I surmise that the provided signature is a compromise,
> supporting both uses, but relying on the programmer not to do
> "something silly" with the returned pointer.

C++ uses its own header files, cstdlib in this case. So there would be no 
problem to provide two overloads for strtol. Other functions in cstdlib, 
like strchr, actually do provide two overloads for pointers to const and 
non-const character arrays. So, why not strtol?

    Heinz


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



