From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1a88c4d509f6381 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: scope and/or parameters (beginner) Date: 1999/04/15 Message-ID: <7f52r9$n7q$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 466745749 References: <37064309.889106243@news.dsuper.net> <37084459.8616007@rocketmail.com> <370b0c99.1137352783@news.dsuper.net> <7f2435$54d$1@nnrp1.dejanews.com> <37149AE9.883147B6@prolifics.com> X-Http-Proxy: 1.0 x9.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Apr 15 16:07:13 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-04-15T00:00:00+00:00 List-Id: In article <37149AE9.883147B6@prolifics.com>, Hyman Rosen wrote: > Robert Dewar wrote: > > Correct. A C programmer would, of course, simply declare > the parameter as being 'const', then insert the test > exactly as you did in Ada. > > Hmph. I'm surprised that you, of all people, are so > parochial. You usually aren't. The "of course" here is mighty forced :-) First, I have never *ever* seen C programmers routinely write prototypes with const in them, as in int max (const int a, const int b) { so to claim that it is standard practice, as implied by your "of course" is really stretching things. Second, please note that in C, if you *do* declare things this way, the effect of assigning to the const object is "undefined" according to the ANSI C standard, not illegal but undefined! Your compiler may be kind enough to give you a warning, gcc does, but it is not even required to do this. So (a) I think the claim that C programmers would of course use the const keyword in this context is completely bogus and (b) even if they do, it does not mean that the compiler will reject attempts to assign to the "const" object. perhaps the abbreviation of constant to const is best interpreted as meaning that it is sort of constant, but not very :-) :-) -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own