Click here to Skip to main content
15,914,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: NetUserGetInfo Problems - PLZ Help Pin
David Crow2-Aug-06 5:53
David Crow2-Aug-06 5:53 
QuestionSize of an empty class Pin
Sarath C2-Aug-06 4:46
Sarath C2-Aug-06 4:46 
AnswerRe: Size of an empty class Pin
Zac Howland2-Aug-06 5:15
Zac Howland2-Aug-06 5:15 
GeneralRe: Size of an empty class Pin
Sarath C2-Aug-06 5:24
Sarath C2-Aug-06 5:24 
GeneralRe: Size of an empty class Pin
Zac Howland2-Aug-06 5:45
Zac Howland2-Aug-06 5:45 
GeneralRe: Size of an empty class Pin
Sarath C2-Aug-06 18:59
Sarath C2-Aug-06 18:59 
AnswerRe: Size of an empty class [modified] Pin
prasad_som2-Aug-06 20:56
prasad_som2-Aug-06 20:56 
GeneralRe: Size of an empty class Pin
Zac Howland3-Aug-06 3:28
Zac Howland3-Aug-06 3:28 
Sarath. wrote:
Anyway it's returning a valid pointer.


On the VC6 compiler, the line with new int[0] would cause an immediate crash in both release and debug builds. I'm not sure if the newer compilers still do that, but the line is invalid code. If the pointer that comes back looks valid, I assure you, it isn't. You are guaranteed to corrupt your memory by writing to the location it gives you.

Sarath. wrote:
my question was, will this create a memory leak?


You won't get a memory leak, you get memory corruption. Basically, the line itself causes a problem, and deleting it is the least of your worries (calling delete won't fix the memory problem you created by trying to declare a 0-sized array).

In general, think logically when programming. It makes no sense to have an array with no capacity; therefore, it is not valid to declare.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

AnswerRe: Size of an empty class Pin
David Crow2-Aug-06 5:51
David Crow2-Aug-06 5:51 
QuestionAnchor a dialog to another dialog Pin
NYTSX2-Aug-06 4:03
NYTSX2-Aug-06 4:03 
AnswerRe: Anchor a dialog to another dialog Pin
Ravi Bhavnani2-Aug-06 4:07
professionalRavi Bhavnani2-Aug-06 4:07 
GeneralRe: Anchor a dialog to another dialog Pin
Sarath C2-Aug-06 4:53
Sarath C2-Aug-06 4:53 
GeneralRe: Anchor a dialog to another dialog Pin
NYTSX2-Aug-06 5:04
NYTSX2-Aug-06 5:04 
GeneralRe: Anchor a dialog to another dialog Pin
Sarath C2-Aug-06 5:07
Sarath C2-Aug-06 5:07 
GeneralRe: Anchor a dialog to another dialog Pin
Ravi Bhavnani2-Aug-06 5:08
professionalRavi Bhavnani2-Aug-06 5:08 
QuestionMicrosft Visual Studio string tables with Similar Strings Pin
Christopher Stratmann2-Aug-06 3:50
Christopher Stratmann2-Aug-06 3:50 
AnswerRe: Microsft Visual Studio string tables with Similar Strings Pin
Ravi Bhavnani2-Aug-06 4:09
professionalRavi Bhavnani2-Aug-06 4:09 
GeneralRe: Microsft Visual Studio string tables with Similar Strings Pin
Christopher Stratmann2-Aug-06 4:14
Christopher Stratmann2-Aug-06 4:14 
AnswerRe: Microsft Visual Studio string tables with Similar Strings Pin
Ravi Bhavnani2-Aug-06 4:21
professionalRavi Bhavnani2-Aug-06 4:21 
GeneralRe: Microsft Visual Studio string tables with Similar Strings Pin
Christopher Stratmann2-Aug-06 4:29
Christopher Stratmann2-Aug-06 4:29 
GeneralRe: Microsft Visual Studio string tables with Similar Strings Pin
Zac Howland2-Aug-06 4:44
Zac Howland2-Aug-06 4:44 
GeneralRe: Microsft Visual Studio string tables with Similar Strings Pin
Christopher Stratmann2-Aug-06 4:47
Christopher Stratmann2-Aug-06 4:47 
GeneralRe: Microsft Visual Studio string tables with Similar Strings Pin
Christopher Stratmann2-Aug-06 4:49
Christopher Stratmann2-Aug-06 4:49 
GeneralRe: Microsft Visual Studio string tables with Similar Strings Pin
Zac Howland2-Aug-06 5:05
Zac Howland2-Aug-06 5:05 
AnswerRe: Microsft Visual Studio string tables with Similar Strings Pin
David Crow2-Aug-06 5:57
David Crow2-Aug-06 5:57 

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.