6 Jun 06:48
Imf::Attribute compiler warning
Ken McGaugh <ken <at> hotchachi.com>
2008-06-06 04:48:07 GMT
2008-06-06 04:48:07 GMT
I'm seeing the following compiler warning under linux with gcc-4.0.2
when extra warnings are enabled (-Wextra):
/usr/local/include/OpenEXR/ImfAttribute.h:256: warning: base
class 'class Imf::Attribute' should be explicitly initialized in the
copy constructor
The code which triggers this is:
Imath::M44f mat;
Imf::Header hdr (720, 486);
hdr.insert("mat", Imf::M44fAttribute(mat));
The warning goes away if I use an intermediate Imf::M44fAttribute
object:
Imath::M44f mat;
Imf::M44fAttribute matAttr (mat);
Imf::Header hdr (720, 486);
hdr.insert("mat", matAttr);
The warning seems benign, but I wanted to check to make sure. Anybody
know for sure?
Also, there is a typo in the commented example for ASSERT in
IexMacros.h. In the example the order of the arguments is listed
incorrectly.
Thanks.
--Ken
(Continue reading)
(comes in handy for a
few other DLL/C++ issues here. Dang. Why didn't I think of this?)
Anyway, what happens is that CreateDLL scans the map file for exports,
object files and DLLs in that order.
By the time the code has arrived at the spot where it's looking for
the DLL dependencies to tell 'link.exe' which matching '.lib's to
load, the scan is prematurely aborted as the 'object file scan'
corrupted the mapfile in memory (stored in buf; 'lineend' is the
offending pointer though).
This happens, because where it says:
- *lineend = '\0';
to replace an EOL by a NUL sentinel for the next of work, the code
assumes this 'lineend' pointer does NOT change until this line:
- *lineend = '\n';
where the EOL is restored.
Alas, this assumption is not true, as there's this bit of code:
if (accept) {
lineend = lineend - 6; // point one
character before ".dll"
while (!isWhitespace(*lineend))
{
--lineend;
RSS Feed