Visual C++ 6.0 compiler problem - Programmer

This is a discussion on Visual C++ 6.0 compiler problem - Programmer ; Hello. I'm having a problem with the Visual C++ 6.0 speed optimization, and hope someone can suggest a workaround. My project includes many C++ files, most of which work fine with speed optimization turned on. At least one does not ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Visual C++ 6.0 compiler problem

  1. Visual C++ 6.0 compiler problem

    Hello.

    I'm having a problem with the Visual C++ 6.0 speed
    optimization, and hope someone can suggest a workaround.

    My project includes many C++ files, most of which work fine with speed
    optimization turned on. At least one does not however, though it does
    work with size optimization turned on. I don't know specifically what
    the optimizer is doing wrong, just that the output is incorrect. And I

    know within about 10 lines where the problem is. I've tried
    rearranging the offending lines (which are straight C code). I've
    tried using 'volitle' data types in hopes of avoiding optimization.
    I've looked for missing variable initializations, but everything looks
    correct and straightforward.

    One solution would be to have a precompiler directive which would
    enable (or disable) the optimization only on specific files. Of course

    I can manually turn the optimization on and off while recompiling
    specific files, but I need something automated.

    I can't post the code, but may try to follow up with a test case that
    exhibits the same behavior.

    Presumably the program would compile fine with g++, but unfortunately
    that's not an option for this project.

    Thanks very much.

    Mark


  2. Re: Visual C++ 6.0 compiler problem

    mjbackues@yahoo.com wrote:
    > ...One solution would be to have a precompiler directive which would
    > enable (or disable) the optimization only on specific files. Of course
    >
    > I can manually turn the optimization on and off while recompiling
    > specific files, but I need something automated.


    Something automated: VC 6 permits you to set the optimization type for
    each file individually. In the project settings C++ page, merely select
    a file from the list on the left then change the "Optimizations" setting
    on the right.

    --
    Scott McPhillips [VC++ MVP]


  3. Re: Visual C++ 6.0 compiler problem

    Thanks very much, this works.

    I also tried "#pragma optimize( "", off )" and "#pragma optimize( "",
    on)" before and after the function, but that did not work.

    I've been unable to create a postable test case that exhibits the
    problem. But the settings thing works for now, and I see that V7 has
    file specific properties, if the program ever gets migrated to that.

    Mark Backues


+ Reply to Thread