🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Default Argument Resolving Problem

#1722
From: Boris Rasin
Date: Mon, 14 Aug 1995 06:49
24 lines
1320 bytes
>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 )
>or at any individual point f is called ( working like a macro
>and resolving the name whatever it stands for at this moment )?

Default arguments are resolved at the declaration point.
I'm sure I read about it somewhere.

*************************************************************
* Stupid news daemon doesn't want to post an article with
* 'more included text then the new text'.
*
* Stupid news daemon doesn't want to post an article with
* 'more included text then the new text'.
*************************************************************
Technical Details
Message-ID: <MATT.95Aug13234947@physics2.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <3vb4t8$14s3@hrz-ws11.hrz.uni-kassel.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: Boris Rasin <brasin@NetVision.net.il>
Newsgroups: comp.std.c++
Subject: Re: Default Argument Resolving Problem
Date: 14 Aug 1995 06:49:47 GMT
Organization: NetVision USENET Site.
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <MATT.95Aug13234947@physics2.Berkeley.EDU>
References: <3vb4t8$14s3@hrz-ws11.hrz.uni-kassel.de>
NNTP-Posting-Host: physics2.berkeley.edu