optimize



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/01/2008 at 23:05, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi!
    Is it a C++ subtlety which I will never understand or is it really
    a compiler fault (Microsoft C++ 6.0) ?
    the following code works fine, but delivers garbage if
    speed-optimized.Whats wrong?
       //------------------------------
       Filename make_Filename(Filename path , String name , String suff )
       {
         Filename p  = path;
         Filename n  = Filename(name);
         Filename pn = p + n;
         pn.SetSuffix(suff);
         return(pn);
       };
       //------------------------------
       ...........
         BaseFile *bf = BaseFile::Alloc();
         Filename filnam;
                  filnam = make_Filename(GeGetPluginPath() , String("test") , String("txt"));
      
                       ---> c:\maxon....\myplugdir est.txt == ok
       speedoptimized  ---> c:\maxon....\myplugdir\.        == :-(
      
         bf->Open(filnam, GE_READ , FILE_DIALOG ,GE_INTEL);
       .....
       //------------------------------
    Can someone help?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/01/2008 at 00:39, xxxxxxxx wrote:

    The backslash '' is used for such things as '\n' you need to use two '\' to get a single character as a backslash.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/01/2008 at 07:18, xxxxxxxx wrote:

    the "" part of the message denotes the two different results of
    a) compiled without optimiziation
    b) *with* optimization



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/01/2008 at 08:45, xxxxxxxx wrote:

    You should use Filename.SetFile() instead of '+' (it's more reliable). Also, I've found that there is no real equivalence for '=' with Filename. Better to do it like this:

    > Filename p = Filename(path);
    > p.SetFile(name);
    > p.SetSuffix(suff);
    > return (p);

    Not certain what you mean by 'speed-optimized'? The default SDK project build settings specify "Maximize Speed" for optimizations.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/01/2008 at 21:47, xxxxxxxx wrote:

    Hi.
    Of course "Maximize Speed.
    I wanted to know, if its my fault (as usual) or if the
    compiler did something wrong.
    unfortunately the function
       Filename make_Filename(Filename path , String name , String suff )
    seems to work correctly. Its the call which does something,
    but I cannot find out whats wrong. Its all a little bit
    worrying, because I have not the slightest idea what to do
    (or not to do).



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/01/2008 at 22:47, xxxxxxxx wrote:

    For which version of C4D is this being built - which SDK?

    I've never experienced a problem like that. This can sometimes be unexpected code problems elsewhere seeping into seemingly good code (e.g.: memory corruption).



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/01/2008 at 00:43, xxxxxxxx wrote:

    Hi.
     c4d 9.6
     sdk 8.5
     I dont believe that this has any importance.
     Memory corruption? No, I dont think so. Maybe an unfortunate
    compiler settings. I think I will compare with the originals.
    I *have* expererienced different behaviour of optimzed/not optimuzed
    programmes but that was my own fault.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/01/2008 at 05:08, xxxxxxxx wrote:

    Sorry, must have been having a dumb moment...

    Have you tried passing them as local variables to see if it makes any difference,e.g.

    > _
    > String test_str="Test",txt_str="Txt";
    >
    > filnam = make_Filename(GeGetPluginPath(), test_str,txt_str);
    > _



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2008 at 01:23, xxxxxxxx wrote:

    HI!
      --> Have you tried passing them as local variables
    Now I have. No difference.
    But I think its really a compiler error.
    As far as I cannot understand that kind of stuff, the compiler
    forgets to reserve memory for the result of GeGetPluginPath()
    on the stack. So the other parameters are overridden and
    this could well explain the results.
    Now I use : Filename localvar = GeGetPluginPath(). ... and so on.
    and its working now.
    ...until the next next time of course.


Log in to reply