Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: stuck with a trivia Pin
«_Superman_»3-Feb-09 22:03
professional«_Superman_»3-Feb-09 22:03 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 22:20
Smith#3-Feb-09 22:20 
AnswerRe: stuck with a trivia Pin
Stuart Dootson3-Feb-09 21:12
professionalStuart Dootson3-Feb-09 21:12 
GeneralRe: stuck with a trivia [modified] Pin
Smith#3-Feb-09 21:24
Smith#3-Feb-09 21:24 
GeneralRe: stuck with a trivia Pin
Stuart Dootson3-Feb-09 22:01
professionalStuart Dootson3-Feb-09 22:01 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 22:14
Smith#3-Feb-09 22:14 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 22:18
Smith#3-Feb-09 22:18 
AnswerRe: stuck with a trivia Pin
Emilio Garavaglia3-Feb-09 23:13
Emilio Garavaglia3-Feb-09 23:13 
The key point is that arrays and pointers are NOT the same.
An array can be converted into a pointer and pointer arithmetic (and indexing) looks the same as array subscripting, but they aren't. They coincide only for linear indexing (that's the case of monodimensional arrays)

int **pyp2 is a "[pointer to a [pointer to [an int]]]"
The memory layout it expects is like
int** ----> [int*, int*, int*, ...]
               |     |     |
               |     |     |
               |     |     V
               |     V    [int,int,...]
               V    [int,int,int...]
              [int, int, ...]

While int py2[2][2] is an "[array of [array of [int]]]"
The memory layout it expects is like
[[int,int],[int,int]]

That's completely different.


2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


GeneralRe: stuck with a trivia Pin
Smith#4-Feb-09 7:44
Smith#4-Feb-09 7:44 
GeneralRe: stuck with a trivia [modified] Pin
Emilio Garavaglia4-Feb-09 21:32
Emilio Garavaglia4-Feb-09 21:32 
GeneralRe: stuck with a trivia Pin
Smith#7-Feb-09 16:13
Smith#7-Feb-09 16:13 
GeneralRe: stuck with a trivia Pin
Emilio Garavaglia4-Feb-09 21:52
Emilio Garavaglia4-Feb-09 21:52 
Questionfatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h></windows.h> [modified] Pin
Kiran Pinjala3-Feb-09 19:38
Kiran Pinjala3-Feb-09 19:38 
AnswerRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
SandipG 3-Feb-09 20:49
SandipG 3-Feb-09 20:49 
GeneralRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
Kiran Pinjala3-Feb-09 21:32
Kiran Pinjala3-Feb-09 21:32 
AnswerRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
«_Superman_»3-Feb-09 20:59
professional«_Superman_»3-Feb-09 20:59 
GeneralRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
Kiran Pinjala3-Feb-09 21:34
Kiran Pinjala3-Feb-09 21:34 
GeneralRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
Smith#3-Feb-09 21:44
Smith#3-Feb-09 21:44 
GeneralRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
Kiran Pinjala3-Feb-09 22:24
Kiran Pinjala3-Feb-09 22:24 
QuestionRe: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include Pin
David Crow4-Feb-09 3:32
David Crow4-Feb-09 3:32 
QuestiontimeSetEvent only in Windows XP? Pin
nm_1143-Feb-09 19:25
nm_1143-Feb-09 19:25 
AnswerRe: timeSetEvent only in Windows XP? Pin
Stuart Dootson3-Feb-09 21:14
professionalStuart Dootson3-Feb-09 21:14 
QuestionEnsuring DialogBox is fully initialized Pin
prashantbhatia0073-Feb-09 19:03
prashantbhatia0073-Feb-09 19:03 
AnswerRe: Ensuring DialogBox is fully initialized Pin
SandipG 3-Feb-09 20:51
SandipG 3-Feb-09 20:51 
AnswerRe: Ensuring DialogBox is fully initialized Pin
prasad_som4-Feb-09 0:48
prasad_som4-Feb-09 0:48 

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.