windowskernelprogrammingbook2e icon indicating copy to clipboard operation
windowskernelprogrammingbook2e copied to clipboard

clarification: sizeof(data) or sizeof(ThreadData), pg. 70 & 71

Open profnandaa opened this issue 2 years ago • 3 comments

On page 70 and 71:

image

Though in the code sample, you are using sizeof(ThreadData): https://github.com/zodiacon/windowskernelprogrammingbook2e/blob/e23f9bb39c7dd6df8a408a6ace46e627211dcf5b/Chapter04/Booster/Booster.cpp#L91

As much as both are 8, it could be misleading since the pointer size will stay the same regardless of struct change.

profnandaa avatar May 02 '23 07:05 profnandaa

sizeof(data) is incorrect because data is a pointer, whose size is fixed (4 or 8 bytes). sizeof(*data) would be correct, but I think sizeof(ThreadData) is clearer, since this is the structure that is used.

zodiacon avatar May 02 '23 13:05 zodiacon

Reminder on this, still there in the latest ed.

profnandaa avatar Sep 25 '23 08:09 profnandaa

fixing

zodiacon avatar Sep 25 '23 14:09 zodiacon