Possible Register Variable Faulup

Is there a storage class specifier or VC compiler switch that prevents a variable from being optimized through locating it in a register?

The reason I'm asking is that I'm having a little ODBC problem where one of my variables isn't receiving a value from an SQL statement during an SQLFetch() operation. I have run into this exact problen using the PowerBASIC programming language many times. That language attempts to automatically use various numbers of registers for auto/local variables for optimazation purposes. However, the address of a variable needs to be passed into SQLBindCol(), and if the compiler uses a register instead of a memory location, nothing shows up in the variable, which is an [out] parameter. In PowerBASIC one must use the #Register None compiler directive which tells the compiler not to use registers for optimizing variables. I've never run into this problem in C++ 'till now. That's why I'm asking.
Never mind. Been working with the problem some more, and it doesn't look like the issue involves the compiler using one of my output parameters as a register variable. It looks like a compiler error at this point. The exact same program is working perfectly with MinGW 4.4.1-2 32 bit, MinGW 4.8.1-3 32 bit, 4.8.1-3 64 bit, and MS VC++ 9 32 bit. It fails with VC++9 64 bit. Will be working on it again tomorrow. The database is SQL Server 2005.
Last edited on
Topic archived. No new replies allowed.