Click here to Skip to main content
15,924,036 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Is it possible to have an array of types ? Pin
Michael Dunn9-Dec-08 13:52
sitebuilderMichael Dunn9-Dec-08 13:52 
QuestionHow to unblock pipe write operation? Pin
sashoalm8-Dec-08 21:39
sashoalm8-Dec-08 21:39 
QuestionNeed some Bits/Bytes and Types information Pin
gabbana8-Dec-08 21:24
gabbana8-Dec-08 21:24 
AnswerRe: Need some Bits/Bytes and Types information Pin
CPallini8-Dec-08 22:16
mveCPallini8-Dec-08 22:16 
AnswerRe: Need some Bits/Bytes and Types information Pin
Code-o-mat8-Dec-08 22:22
Code-o-mat8-Dec-08 22:22 
AnswerRe: Need some Bits/Bytes and Types information Pin
gabbana8-Dec-08 22:32
gabbana8-Dec-08 22:32 
GeneralRe: Need some Bits/Bytes and Types information Pin
gabbana8-Dec-08 22:35
gabbana8-Dec-08 22:35 
GeneralRe: Need some Bits/Bytes and Types information Pin
Code-o-mat8-Dec-08 23:00
Code-o-mat8-Dec-08 23:00 
As far as i can tell, you understood it quite well. Just to clear things up, a pointer alone always points at 1 byte in memory, giving it a type is, how to say, just a more clear, logical way of handling things. Hmm, hard to explain what i mean, i try to give an example:

WORD *WordPointer = (WORD *)malloc(sizeof(char));

So, althorough WordPointer is assumed to be pointing at a WORD being 2 bytes, it still points at the 1 allocated byte. So if then you do

*WordPointer = 3;

It will write 2 bytes in memory but we only allocated 1 byte, this can result in 2 (or maybe more) things:

-You get an access violation because you are trying to write a memory location (the second byte) that does not belong to your process. This is a better result because it is much easier to track down and correct.
-The second byte of the word actually belongs to your process but is part of something else, for example an integer's first byte you use somewhere else, then you owerwrite this changing your integer, this problem is much harder to track down and correct because it doesn't result in an error right away but maybe later when you try to use your integer and see that it has some bogous value and you have no idea where it came.

</smartass_mode> Smile | :)

I hope this is clear, don't want to lecture you, just thought this info might be useful for you. Smile | :)

> The problem with computers is that they do what you tell them to do and not what you want them to do. <

GeneralRe: Need some Bits/Bytes and Types information Pin
gabbana9-Dec-08 0:51
gabbana9-Dec-08 0:51 
Questiondifference between CreateThread & AfxBeginThread Pin
Nikesh Jagtap8-Dec-08 21:17
Nikesh Jagtap8-Dec-08 21:17 
AnswerRe: difference between CreateThread & AfxBeginThread Pin
Roger Stoltz8-Dec-08 21:27
Roger Stoltz8-Dec-08 21:27 
AnswerRe: difference between CreateThread & AfxBeginThread [modified] Pin
Defenestration8-Dec-08 22:32
Defenestration8-Dec-08 22:32 
AnswerRe: difference between CreateThread & AfxBeginThread Pin
Roger Stoltz8-Dec-08 22:42
Roger Stoltz8-Dec-08 22:42 
GeneralRe: difference between CreateThread & AfxBeginThread Pin
Defenestration8-Dec-08 22:51
Defenestration8-Dec-08 22:51 
QuestionHow to write string values in .csv file Pin
MsmVc8-Dec-08 20:40
MsmVc8-Dec-08 20:40 
AnswerRe: How to write string values in .csv file Pin
Cedric Moonen8-Dec-08 20:51
Cedric Moonen8-Dec-08 20:51 
AnswerRe: How to write string values in .csv file Pin
SandipG 8-Dec-08 20:52
SandipG 8-Dec-08 20:52 
GeneralRe: How to write string values in .csv file Pin
MsmVc8-Dec-08 21:10
MsmVc8-Dec-08 21:10 
QuestionRe: How to write string values in .csv file Pin
Rajesh R Subramanian8-Dec-08 21:01
professionalRajesh R Subramanian8-Dec-08 21:01 
QuestionWindows Installer for a C++/MFC application Pin
Puneet Kulkarni8-Dec-08 19:46
Puneet Kulkarni8-Dec-08 19:46 
QuestionWhy do some combinations of port settings fail ? Pin
kapardhi8-Dec-08 19:34
kapardhi8-Dec-08 19:34 
AnswerRe: Why do some combinations of port settings fail ? Pin
Roger Stoltz8-Dec-08 21:43
Roger Stoltz8-Dec-08 21:43 
QuestionSafe way to initialize LARGE_INTEGER with int ? Pin
Defenestration8-Dec-08 18:42
Defenestration8-Dec-08 18:42 
Questionconnect to MS Excel database on windows XP from winCE device Pin
parthsarathy8-Dec-08 18:01
parthsarathy8-Dec-08 18:01 
QuestionDo you put :: in front of every Windows API call ? Pin
Defenestration8-Dec-08 17:42
Defenestration8-Dec-08 17:42 

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.