Re: two issues with unsigned int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




brac37 wrote:
> 
> Version: g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
> 
> The first issue is actually a bug. What I did was passing an int by
> reference to a void function with an unsigned int by reference as
> parameter. The compiler did not complain, instead it produced bullshit
> code.
> 
> The second issue was moronlike behavior. What I did was passing the
> integer constant 0 to a function name with two functions associated to it.
> One was unsigned int name (unsigned int) and the other void name (int *).
> Now the compiler gave the error that name (0) was ambiguous since he did
> not know if he should convert from int to unsigned int or from int to
> int*.
> 

I got a reaction by e-mail, but I can not find it here. It was advised to
make a bug report with a test case. This will do for the first problem, but
I do not think the second problem is actually a bug. Since the reaction did
not give explanation about what could be going on, I will give it a try.

The designers of c++ wanted people to write, or at least be able to write
> PointerType p = 0;
or
> PointerType p (0);
instead of
> PointerType p = NULL;
or
> PointerType p (NULL);
For that purpose, the copy constructor from integers to pointers was made
implicit. Therefore, the compiler does not know what implicit copy
constructor to choose: (unsigned int)(int) or (int *)(int).

My opinion was already before running into this issue that the designers of
c++ made a bad choice here. But given that choice, it would be nice when the
compiler should choose integer conversion whenever possible before
complaining about ambiguity.
-- 
View this message in context: http://old.nabble.com/two-issues-with-unsigned-int-tp29621719p29641733.html
Sent from the gcc - Help mailing list archive at Nabble.com.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux