Closed nwolek closed 9 years ago
This issue is a trip-up. To make it worse some compilers treat it differently than others. The compiler knows that a an int and TTInt32 are the same thing, so why not use that instead saying it can't figure out the difference between them?
Having been plagued by this for years, a very simple solution just occurred to me. Please make sure no C++ purist police are around. Maybe TTInt32 should not be a typedef but instead should be a #define.
best, | : ||
On Wed, Dec 11, 2013 at 7:26 AM, nwolek notifications@github.com wrote:
The compiler is fine with the following:
int myInt = 42; TTValue myValue(myInt);
But it complains that the following is "ambiguous":
TTInt32 myTTInt = 42; TTValue myAmbiguousValue(myTTInt);
Particularly weird is that the follow 2 seem legal:
TTUInt32 myUnsignedInt = 42; TTValue myValue2(myUnsignedInt); TTFloat32 myFloat = 42.78738; TTValue myValue3(myFloat);
This issue has tripped me up several times. The complaint from the compiler always points to the following line of code instead of the point in the code where it is called, which makes it very hard to debug:
https://github.com/jamoma/JamomaCore/blob/master/Foundation/library/includes/TTValue.h#L46
— Reply to this email directly or view it on GitHubhttps://github.com/jamoma/JamomaCore/issues/191 .
I am most certainly not a member of the "C++ purist police". I am for whatever makes this time sink go away. :)
Oblique strategy of the day….
On 11 Dec 2013, at 15:07, Timothy Place notifications@github.com wrote:
Please make sure no C++ purist police are around.
The TTValue unit test caught a bug caused by a typo I made :-) So good to catch that right away in Xcode!
thumbs up for unit tests!
The compiler is fine with the following:
But it complains that the following is "ambiguous":
Particularly weird is that the follow 2 seem legal:
This issue has tripped me up several times. The complaint from the compiler always points to the following line of code instead of the point in the code where it is called, which makes it very hard to debug: https://github.com/jamoma/JamomaCore/blob/master/Foundation/library/includes/TTValue.h#L46