Re: compiler error

From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 02/15/04


Date: Sun, 15 Feb 2004 01:11:29 +0000

In message <157t20h36fkm1vmr0mq7jolbq28t78a3is@4ax.com>, Robert W Hand
<rwhand@NOSPAMoperamail.com> writes
>On Sat, 14 Feb 2004 21:54:47 +0000 (UTC), "Jason"
><jason.carney1@btinternet.com> wrote:
>
>>int a, b, c;
>>//place values in a,b,c using atoi

read his code, specifically the comment above.

>>x.func(a, b, c);
>>
>>And the compiler says this:
>>
>>no matching function for call to 'XClass::func(int&, int&, int&)
>>candidates are: int XClass::func(int, int, int);
>>
>>What might have gone wrong?
>>
>>Clearly I have declared a,b,c ok and not done much with them except set them
>>to certain values. Why would the compiler complain that I am calling the
>>function using references when I am not?
>
>It is undefined behavior.
He said he had omitted the initialisation code. Anyway even if he
actually left it out, the compiler would not do what he reports.

> Automatic variables that are not
>initialized have indeterminant values. You are not allowed to assign
>their values to other variables. But you can assign the objects a, b,
>c to references to int without specifying values for a, b, c. So it
>may be that your compiler has noted the undefined behavior and warned
>you about it.
>
>Perhaps someone will have a better idea.
>
>Best wishes,
>
>Bob

-- 
Francis Glassborow      ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects


Relevant Pages

  • Re: compiler error
    ... Why would the compiler complain that I am calling the ... It is undefined behavior. ... Automatic variables that are not ... c to references to int without specifying values for a, b, c. So it ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Help me identify a Cobol database
    ... I DO/Don't know COBOL ... As indicated M/F traditionally use xxxx.DAT to indicate the data file, but in this instance,, the developer chose to use the extension xxxx.DB. ... To complicate it even further,, the developer, in order to save disk space, may have used a compiler DIRECTIVE to compress data - basically repeating characters are indicated by a count. ... I don't know whether they are still active but if you google on 'COBOL FAQ',, it may have references to COBOL Developers who have produced Data conversions - primarily they were aiming at converting from COBOL-Vendor-A to COBOL-Vendor-B compilers. ...
    (comp.lang.cobol)
  • Re: CASE mis-understanding?
    ... The standard undefines ... Who says undefined behavior has to mean "crash"? ... So I wouldn't say the compiler ... the second step looks at code which might be dead if undefined ...
    (comp.lang.forth)
  • Re: Is this valid C statement?
    ... > Unless the type name specifies a void type, ... >any constraint), but it invokes undefined behavior, since the standard ... The ones the compiler can detect. ... They may diagnose them, but typically only if the user ...
    (comp.lang.c)
  • Need help figuring out: "CVT1100 Duplicate Resource: type ICON"
    ... I tried changing the value of typelib resource ID - I tried a whole ... Since the MSDN groups couldn't offer any enlightenment other than to say ... I commented out ALL references I got "CVT1100 duplicate resource type Dialog ... This program compiles using the 4.2 compiler - there is still a version ...
    (microsoft.public.dotnet.languages.vc)