Closed
Bug 818391
Opened 12 years ago
Closed 12 years ago
nsMultiplexInputStream.cpp(514) : error C2668: 'abs' : ambiguous call to overloaded function
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: philip.chee, Assigned: longsonr)
References
Details
Attachments
(1 file, 1 obsolete file)
687 bytes,
patch
|
MatsPalmgren_bugz
:
review+
justin.lebar+bug
:
review+
|
Details | Diff | Splinter Review |
MVS2008SP1 on Windows7 x64:
c:/t1/hg/comm-central/mozilla/xpcom/io/nsMultiplexInputStream.cpp(514) : error C2668: 'abs' : ambiguous call to overloaded function
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(485): could be 'long abs(long)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(487): or 'doubleabs(double)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(491): or 'float abs(float)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(539): or 'long double abs(long double)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdlib.h(380): or 'int abs(int)'
while trying to match the argument list '(int64_t)'
c:/t1/hg/comm-central/mozilla/xpcom/io/nsMultiplexInputStream.cpp(522) : error C2668: 'abs' : ambiguous call to overloaded function
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(485): could be 'long abs(long)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(487): or 'doubleabs(double)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(491): or 'float abs(float)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(539): or 'long double abs(long double)'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdlib.h(380): or 'int abs(int)'
while trying to match the argument list '(int64_t)'
Comment 1•12 years ago
|
||
Sorry I broke your build. I'm a bit puzzled why it doesn't pick abs(long) though -
is 'long' not 64-bit? If you add back the NS_ABS template in this file and
revert the change, does the build succeed?
Comment 2•12 years ago
|
||
C++11 is required to have std::abs(long long) but apparently MVS2008SP1 doesn't.
Perhaps we could add it to std namespace with something like:
#if VISUAL_VERSION <= 2008 // or whatever
namespace std {
long long abs(long long v) { return llabs(v); }
}
#endif
Assignee | ||
Comment 3•12 years ago
|
||
(In reply to Mats Palmgren [:mats] from comment #1)
> Sorry I broke your build. I'm a bit puzzled why it doesn't pick abs(long)
> though -
> is 'long' not 64-bit? If you add back the NS_ABS template in this file and
> revert the change, does the build succeed?
With MS Visual Studio long is 32 bit (same as int) 64 bit would be long long.
Comment 4•12 years ago
|
||
I see, thanks. Does the suggested std::abs(long long) overload work if you put
it in nsMultiplexInputStream.cpp?
Assignee | ||
Comment 5•12 years ago
|
||
This works. My compilation is still running so I don't know if it's the only place yet.
Comment 6•12 years ago
|
||
Thanks for investigating. I think I still prefer the "long long" type though
(if it works), so we use the exact same signatures for all platforms.
Perhaps it's better to add it to nsAlgorithm.h even if it turns out to be just
this file, so that it will work for new code. (I didn't remove any of the
#includes for nsAlgorithm.h in bug 817574)
Assignee | ||
Comment 7•12 years ago
|
||
Comment on attachment 688778 [details] [diff] [review]
patch
All the other files compile OK.
Attachment #688778 -
Flags: review?(matspal)
Assignee | ||
Comment 8•12 years ago
|
||
Assignee: nobody → longsonr
Attachment #688778 -
Attachment is obsolete: true
Attachment #688778 -
Flags: review?(matspal)
Attachment #688831 -
Flags: review?(matspal)
Comment 9•12 years ago
|
||
Comment on attachment 688831 [details] [diff] [review]
or this...
Looks good to me, but I'm not a xpcom peer.
Attachment #688831 -
Flags: review?(matspal)
Attachment #688831 -
Flags: review?(justin.lebar+bug)
Attachment #688831 -
Flags: review+
Updated•12 years ago
|
Attachment #688831 -
Flags: review?(justin.lebar+bug) → review+
Updated•12 years ago
|
Severity: normal → blocker
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in
before you can comment on or make changes to this bug.
Description
•