Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: AcceptEx and WSARecv question in IOCP Pin
followait26-May-06 23:10
followait26-May-06 23:10 
GeneralRe: AcceptEx and WSARecv question in IOCP Pin
valikac27-May-06 18:47
valikac27-May-06 18:47 
GeneralRe: AcceptEx and WSARecv question in IOCP Pin
followait27-May-06 20:25
followait27-May-06 20:25 
QuestionType Conversion Pin
satsumatable25-May-06 18:56
satsumatable25-May-06 18:56 
AnswerRe: Type Conversion [modified] Pin
Stephen Hewitt25-May-06 21:27
Stephen Hewitt25-May-06 21:27 
GeneralRe: Type Conversion [modified] Pin
satsumatable26-May-06 17:01
satsumatable26-May-06 17:01 
GeneralRe: Type Conversion [modified] Pin
Stephen Hewitt26-May-06 17:46
Stephen Hewitt26-May-06 17:46 
Questionswap Red and Blue in GDI+ Pin
ilidan25-May-06 18:45
ilidan25-May-06 18:45 
AnswerRe: swap Red and Blue in GDI+ Pin
_anil_25-May-06 19:37
_anil_25-May-06 19:37 
GeneralRe: swap Red and Blue in GDI+ Pin
ilidan25-May-06 19:50
ilidan25-May-06 19:50 
GeneralRe: swap Red and Blue in GDI+ Pin
_anil_25-May-06 20:01
_anil_25-May-06 20:01 
GeneralRe: swap Red and Blue in GDI+ Pin
ilidan25-May-06 20:14
ilidan25-May-06 20:14 
Questionpointer [modified] Pin
jith - iii25-May-06 18:45
jith - iii25-May-06 18:45 
AnswerRe: pointer Pin
PJ Arends25-May-06 18:59
professionalPJ Arends25-May-06 18:59 
AnswerRe: pointer Pin
S. Senthil Kumar25-May-06 19:04
S. Senthil Kumar25-May-06 19:04 
GeneralRe: pointer Pin
jith - iii25-May-06 19:22
jith - iii25-May-06 19:22 
GeneralRe: pointer Pin
S. Senthil Kumar25-May-06 19:52
S. Senthil Kumar25-May-06 19:52 
GeneralRe: pointer [modified] Pin
jith - iii25-May-06 21:09
jith - iii25-May-06 21:09 
GeneralRe: pointer Pin
S. Senthil Kumar25-May-06 22:59
S. Senthil Kumar25-May-06 22:59 
GeneralRe: pointer [modified] Pin
jith - iii25-May-06 23:31
jith - iii25-May-06 23:31 
GeneralRe: pointer [modified] Pin
S. Senthil Kumar26-May-06 14:27
S. Senthil Kumar26-May-06 14:27 
GeneralRe: pointer [modified] Pin
jith - iii26-May-06 19:02
jith - iii26-May-06 19:02 
GeneralRe: pointer [modified] Pin
S. Senthil Kumar26-May-06 20:42
S. Senthil Kumar26-May-06 20:42 
jithAtran - ii wrote:
That means i has been given an address space in the memory(1000/1001).
Now we are trying to store an address say

like
______________
__00__|___7D__ where 007D is the address of a
1000 1001 float variable.

Now here is my doubt.How compiler knows this assignment is wrong.


Well, you're not doing
int *p = 0x007D;

are you? You are attempting to assign the address of a float variable to an integer pointer, so that's why the assignment is wrong.

The compiler knows this because, when it compiles code, it keeps track of the type of all variables, using something called a symbol table[^]. When it's time to generate code, it sees this line
float k = 10.0;
int *p = &k;

it realizes that p is a pointer to int and k is a float and therefore generates an error. If you want to know how it gets that information from the source code, google for "Parsing and Syntax Analysis", which is a pretty huge topic in itself.

Again, the compiler doesn't know addresses 1001/1002 are for pointing to integers, rather, it only knows that p is a pointer to an integer. The absolute address of the pointer itself is determined at runtime.

Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
GeneralRe: pointer [modified] Pin
jith - iii26-May-06 22:30
jith - iii26-May-06 22:30 
GeneralRe: pointer [modified] Pin
Stephen Hewitt26-May-06 18:05
Stephen Hewitt26-May-06 18:05 

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.