🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Default Argument Resolving Problem

#1658
From: Fergus Henderson
Date: Thu, 03 Aug 1995 15:36
23 lines
1181 bytes
Ralf Boecker <boecker@hrz.uni-kassel.de> writes:

>Take a look at this Code:
>
>extern int i = 1;
>extern void f( int x = i );
>extern int main() {
>    i = 2;
>    f(); // == f(2) of course
>    int i = 3; // from now on lokal i hides global i
>    f(); // f(2) or f(3) ?
>}; 
>
>At which point will the *name* of a default argument be resolved?
>- at declaration Point ( so it is bound to a reference )

Yes, at the point of declaration.  See DWP _dcl.func.default_ 8.3.6/5.

-- 
Fergus Henderson              | Designing grand concepts is fun;
fjh@cs.mu.oz.au               | finding nitty little bugs is just work.
http://www.cs.mu.oz.au/~fjh   | -- Brooks, in "The Mythical Man-Month".
PGP key fingerprint: 00 D7 A2 27 65 09 B6 AC  8B 3E 0F 01 E7 5D C4 3F
Technical Details
Message-ID: <9521601.10022@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!munta.cs.mu.OZ.AU!fjh
References: <3vb4t8$14s3@hrz-ws11.hrz.uni-kassel.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Default Argument Resolving Problem
Message-ID: <9521601.10022@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <3vb4t8$14s3@hrz-ws11.hrz.uni-kassel.de>
Date: Thu, 3 Aug 1995 15:36:26 GMT