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

C / C++ / MFC

 
Questionpointer question Pin
shaderx20-Sep-06 8:47
shaderx20-Sep-06 8:47 
AnswerRe: pointer question Pin
Chipperm20-Sep-06 8:55
Chipperm20-Sep-06 8:55 
GeneralRe: pointer question Pin
shaderx20-Sep-06 9:03
shaderx20-Sep-06 9:03 
AnswerRe: pointer question Pin
toxcct20-Sep-06 9:09
toxcct20-Sep-06 9:09 
GeneralRe: pointer question Pin
shaderx20-Sep-06 9:13
shaderx20-Sep-06 9:13 
AnswerRe: pointer question Pin
Zac Howland20-Sep-06 9:33
Zac Howland20-Sep-06 9:33 
GeneralRe: pointer question Pin
Stephen Hewitt20-Sep-06 13:57
Stephen Hewitt20-Sep-06 13:57 
GeneralRe: pointer question Pin
Zac Howland20-Sep-06 15:11
Zac Howland20-Sep-06 15:11 
Stephen Hewitt wrote:
d st[100];// fill in each st somewhere// p is allocated in a Vertex buffermemcpy(p, &st, sizeof(st));


That works until you do something like this:

d* st = new d[100];
memcpy(p, st, sizeof(st)); // oops!  won't work
memcpy(p, st, sizeof(d) * 100); // works!


If you want to change the size of the array, it is better to do this:

const unsigned long ARRAY_SIZE = 100;
d st[ARRAY_SIZE];
memcpy(p, st, sizeof(d) * ARRAY_SIZE);


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: pointer question Pin
Stephen Hewitt20-Sep-06 14:01
Stephen Hewitt20-Sep-06 14:01 
QuestionBuild Dependencies Problem Pin
Brooks Harris20-Sep-06 8:29
Brooks Harris20-Sep-06 8:29 
AnswerRe: Build Dependencies Problem Pin
Brooks Harris20-Sep-06 11:20
Brooks Harris20-Sep-06 11:20 
QuestionFunction GetAsyncKeyState() can't be used in system service,why? Pin
nopainnogain20-Sep-06 7:59
nopainnogain20-Sep-06 7:59 
QuestionRe: Function GetAsyncKeyState() can't be used in system service,why? Pin
David Crow20-Sep-06 8:30
David Crow20-Sep-06 8:30 
AnswerRe: Function GetAsyncKeyState() can't be used in system service,why? Pin
nopainnogain20-Sep-06 8:50
nopainnogain20-Sep-06 8:50 
AnswerRe: Function GetAsyncKeyState() can't be used in system service,why? Pin
nopainnogain20-Sep-06 17:55
nopainnogain20-Sep-06 17:55 
QuestionSave me! @_@! Pin
WinXYhappy20-Sep-06 6:20
WinXYhappy20-Sep-06 6:20 
AnswerRe: Save me! @_@! Pin
toxcct20-Sep-06 6:24
toxcct20-Sep-06 6:24 
GeneralRe: Save me! @_@! Pin
WinXYhappy20-Sep-06 6:37
WinXYhappy20-Sep-06 6:37 
GeneralRe: Save me! @_@! Pin
toxcct20-Sep-06 6:46
toxcct20-Sep-06 6:46 
AnswerRe: Save me! @_@! Pin
led mike20-Sep-06 6:27
led mike20-Sep-06 6:27 
GeneralRe: Save me! @_@! Pin
WinXYhappy20-Sep-06 7:25
WinXYhappy20-Sep-06 7:25 
GeneralRe: Save me! @_@! Pin
Zac Howland20-Sep-06 7:39
Zac Howland20-Sep-06 7:39 
GeneralRe: Save me! @_@! Pin
WinXYhappy20-Sep-06 8:02
WinXYhappy20-Sep-06 8:02 
GeneralRe: Save me! @_@! Pin
led mike20-Sep-06 8:03
led mike20-Sep-06 8:03 
GeneralRe: Save me! @_@! Pin
toxcct20-Sep-06 8:12
toxcct20-Sep-06 8:12 

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.