Click here to Skip to main content
15,905,915 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralAlmost There . . . just one more question Pin
tbbooher16-Feb-02 18:22
tbbooher16-Feb-02 18:22 
GeneralHelp me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 16:58
Julia Larson16-Feb-02 16:58 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Shog916-Feb-02 17:44
sitebuilderShog916-Feb-02 17:44 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 18:06
Julia Larson16-Feb-02 18:06 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Shog916-Feb-02 18:28
sitebuilderShog916-Feb-02 18:28 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 18:57
Julia Larson16-Feb-02 18:57 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 19:09
Julia Larson16-Feb-02 19:09 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Shog916-Feb-02 19:39
sitebuilderShog916-Feb-02 19:39 
Life is Full of Suprises

VC++ in debug mode assignes non-NULL values to newly allocated memory as a debug helper. This explains why it works in debug.

pszBuffer should not be NULL. I'm not sure why i told you to get rid of the line that checked for that. (not sure why i'm still on CP at 12:30AM either... great, another addiction)

However, the data pointed to by pszBuffer might easily be NULL. Especially the first character, since this would be the NULL terminator on an emtpy string. Internally, CStrings maintain a length counter, so the actual databuffer can be any size. The NULL terminator is strictly for the convenience of C-style string handling routines that need to access the CString. Keep in mind how the standard C library functions work: strcpy() does not require a length specifier, but is a danger spot for buffer overruns if you are not careful, since it does not (and cannot) check that the destination buffer is large enough to hold the source string. strncpy() does require a length specifier, and uses that to operate safely.

This is why using a string class instead of raw C-style strings is nice; constantly having to make your code aware of the total size of buffers gets old in a hurry.

Anyway, sorry you have to be working on the weekend; good luck on your project!

farewell goodnight last one out turn out the lights
Smashing Pumpkins, Tales of a Scorched Earth

GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 20:12
Julia Larson16-Feb-02 20:12 
GeneralIt slowly dawns on me Pin
Julia Larson16-Feb-02 19:16
Julia Larson16-Feb-02 19:16 
GeneralCDialogBar Pin
16-Feb-02 16:28
suss16-Feb-02 16:28 
GeneralRe: CDialogBar Pin
Derek Waters17-Feb-02 11:27
Derek Waters17-Feb-02 11:27 
GeneralDrawing Controls Problem Pin
John Clump16-Feb-02 16:13
John Clump16-Feb-02 16:13 
GeneralRe: Drawing Controls Problem Pin
Shog916-Feb-02 16:25
sitebuilderShog916-Feb-02 16:25 
GeneralRe: Drawing Controls Problem Pin
John Clump16-Feb-02 18:00
John Clump16-Feb-02 18:00 
GeneralRe: Drawing Controls Problem Pin
Shog916-Feb-02 18:30
sitebuilderShog916-Feb-02 18:30 
GeneralRe: Drawing Controls Problem Pin
Ravi Bhavnani16-Feb-02 19:19
professionalRavi Bhavnani16-Feb-02 19:19 
GeneralRe: Drawing Controls Problem Pin
John Clump16-Feb-02 19:47
John Clump16-Feb-02 19:47 
GeneralHelp on Designing Tictactoe in VC++ Pin
John Cruz16-Feb-02 15:38
John Cruz16-Feb-02 15:38 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Shog916-Feb-02 16:18
sitebuilderShog916-Feb-02 16:18 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
alex.barylski16-Feb-02 22:28
alex.barylski16-Feb-02 22:28 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
John Cruz18-Feb-02 12:43
John Cruz18-Feb-02 12:43 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Christian Graus18-Feb-02 12:47
protectorChristian Graus18-Feb-02 12:47 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Andrew Peace18-Feb-02 13:09
Andrew Peace18-Feb-02 13:09 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
alex.barylski18-Feb-02 14:49
alex.barylski18-Feb-02 14:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.