From -5900839438898091321
X-Google-Thread: f78e5,84b1489db50fe20d
X-Google-Attributes: gidf78e5,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 14 Nov 2007 13:10:43 -0600
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
X-SMTP-Auth: no
From: "Roman.Perepelitsa@gmail.com" <Roman.Perepelitsa@gmail.com>
Newsgroups: comp.std.c++
Subject: Re: static member function and const
Organization: http://groups.google.com
Message-ID: <1195032555.778550.210270@50g2000hsm.googlegroups.com>
References: <1194932017.215138.261760@e9g2000prf.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.0 lonwhs01px01 (NetCache NetApp/6.0.4P1D1)
Complaints-To: groups-abuse@google.com
Injection-Info: 50g2000hsm.googlegroups.com; posting-host=194.205.246.151;
   posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Wed, 14 Nov 2007 13:02:59 CST
Lines: 37
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-ykDFfhT5+usZckKGlSAWS/KDCAUm3b9XfvAEzF1pm+DlCb0lQXaqiZ/CiGXWC9CFxQXLUN50OHH5A9O!nr51QEwqtqCAHHT4CcvGCcT951M0liOAdj0pLlbOhb5/qz9t/I/2biJNmiSSDTt+2IUQZ5TZu0ra!OBbp39ta5Q==
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.35
Xref: g2news1.google.com comp.std.c++:9617

On 13 Nov, 10:43, "subramanian10...@yahoo.com, India"
<subramanian10...@yahoo.com> wrote:
> why can't a static member function be declared as const ?
> We can declare a non-static member function as const,
> to indicate that it does not modify the non-mutable data
> members of a class. In the same way, is there a provision
> to indicate that a static member function does not modify
> the static data members but only uses their values ?
>
> Kindly explain.

It would be pointless, because you can easily remove
const without a cast.

struct foo
{
   static void bar() const;
   int i;
};

int & get_foo_i() { return foo::i; }

void foo::bar() const
{
   int & hacked = get_foo_i();
   // use hacked
}

Regards,
Roman Perepelitsa.

---
[ 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                      ]



