Results 1 to 5 of 5

Thread: daeDoubleType::memoryToString() differs in release/debug

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    8

    daeDoubleType::memoryToString() differs in release/debug

    Hi,

    SYSTEM: Windows XP

    When I create a COLLADA file with floatArrays I have a problem in release mode.

    In Debug mode the floats are written with a ".".
    In Release mode the floats are written with a ",".

    It seems that the following call is responsible for that:

    #ifdef WIN32
    // Microsoft's stringstream implementation has weird performance issues
    static char buffer[64];
    ---> _snprintf(buffer, 64, _printFormat, *((daeDouble*)src)); <---
    dst << buffer;
    #else
    dst << *(daeDouble*)src;
    #endif

    Any suggestions?

    Regards
    Wu

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    I'm a bit confused. You mean a float will get written out as "1234.567" (dot) in debug mode but "1234,567" (comma) in release mode? That's bizarre. Does it happen for all floats or just floats in <float_array>?

    I haven't heard of this problem before. I'll try to reproduce it tomorrow. If you have a short code snippet that demonstrates the problem that'd be really helpful.

    Steve

  3. #3
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    Likely to be a language setting. Europe is using ',' US is using '.'
    BTW, the top of the XML file should indicate the encoding, and a fully compliant application should be able to load both encoding...

    -- Remi

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Quote Originally Posted by remi
    Likely to be a language setting.
    I agree it's probably a language setting. I can't figure out why it would be different in debug from release though.

    Just for the record, I can't reproduce this on my Windows XP box. Here's the code I'm using (a test from the domTest suite):
    Code :
    DefineTest(floatArray) {
    	DAE dae;
    	string file = getTmpFile("floatArray.dae");
    	daeElement* floatArray =
    	           dae.add(file)->add("library_geometries geometry mesh source float_array");
    	CheckResult(floatArray);
    	floatArray->setCharData("0.0 1 2.1234 345.678");
    	CheckResult(dae.writeAll());
    	return testResult(true);
    }
    I get the expected results for my language setting, in both debug and release: <float_array ...>0 1 2.1234 345.678</float_array>

    Steve

  5. #5
    Junior Member
    Join Date
    Jun 2006
    Location
    Morrison, CO
    Posts
    22
    Perhaps the problem is coming from higher up. He seems to indicate this
    _snprintf(buffer, 64, _printFormat, *((daeDouble*)src));
    as the cause of the problem. Maybe something upstream is setting _printFormat differently?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •