Click here to Skip to main content
15,894,180 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Questioncan any body tell me the code for customizing the crystal reports Pin
indian14326-Jan-07 18:30
indian14326-Jan-07 18:30 
Question.Net Reactor Pin
Glen Harvy26-Jan-07 13:55
Glen Harvy26-Jan-07 13:55 
Questionwebcam preview Pin
sini8725-Jan-07 12:15
sini8725-Jan-07 12:15 
AnswerRe: webcam preview Pin
Christian Graus26-Jan-07 10:51
protectorChristian Graus26-Jan-07 10:51 
Questionmanaged c++.net: allocating the memory for an array of struct in a coherent memory area Pin
HUMPPAAA!25-Jan-07 9:43
HUMPPAAA!25-Jan-07 9:43 
AnswerRe: managed c++.net: allocating the memory for an array of struct in a coherent memory area Pin
Christian Graus26-Jan-07 10:51
protectorChristian Graus26-Jan-07 10:51 
GeneralRe: managed c++.net: allocating the memory for an array of struct in a coherent memory area Pin
HUMPPAAA!31-Jan-07 23:25
HUMPPAAA!31-Jan-07 23:25 
GeneralRe: managed c++.net: allocating the memory for an array of struct in a coherent memory area Pin
Luc Pattyn1-Feb-07 1:56
sitebuilderLuc Pattyn1-Feb-07 1:56 
There is nothing really strange about that, C (and C++ I guess) pads all its structs
so all elements are "naturally aligned" (to an adr that is a multiple of their size),
and aligns the entire struct to the size of the largest element, in your case 4B due to the DWORD/int.
The reason is the compiler can then emit code that manipulates 4B quantities without worrying
about alignment and/or achieving highest performance. (Some processors do not know how to
load a DWORD from an unaligned adr, others do but take more time to do it).

The net result is:

1)
if your struct's size is not a multiple of 4 but contains elements sized 4B, the struct will
act as if its size is a multiple of 4B (even when sizeof shows otherwise).

2)
if the elements in your struct are not "naturally aligned", the struct will be padded with
extra bytes to achieve the natural alignment (=each element gets aligned according to its size).
So
struct {
byte a; // offset 0
short b; // 1 ? not naturally aligned
byte c; // 3 ? OK
byte d; // 4 ? OK
long e; // 5 ? not naturally aligned
}

gets compiled as if it were:
struct {
byte a; // offset 0
byte bDummy;
short b; // offset 2
byte c; // offset 4
byte d; // offset 5
byte eDummy1;
byte eDummy2;
long e; // offset 8
}

The function you used was an old one, relying on a stride of 6B, so something special needed
to be done. In C (and C++ I guess) there are compiler switches and/or pragmas to disable
the alignment/padding. In C# your splitting the 4B into two 2B elements is probably the
best way to get what you needed.

Smile | :)








Luc Pattyn

QuestionDataBinding the UI control to the array element ? Pin
Patrick Sky24-Jan-07 20:57
Patrick Sky24-Jan-07 20:57 
AnswerRe: DataBinding the UI control to the array element ? Pin
Patrick Sky24-Jan-07 21:02
Patrick Sky24-Jan-07 21:02 
QuestionSharing A Folder through WebApplication In .Net Pin
Nagaraju_Focus24-Jan-07 19:42
Nagaraju_Focus24-Jan-07 19:42 
Questionfrom .NET to src code (and all points between...) Pin
john john mackey24-Jan-07 8:22
john john mackey24-Jan-07 8:22 
AnswerRe: from .NET to src code (and all points between...) Pin
Pete O'Hanlon24-Jan-07 9:26
mvePete O'Hanlon24-Jan-07 9:26 
GeneralRe: from .NET to src code (and all points between...) Pin
john john mackey24-Jan-07 12:02
john john mackey24-Jan-07 12:02 
GeneralRe: from .NET to src code (and all points between...) Pin
Pete O'Hanlon24-Jan-07 22:36
mvePete O'Hanlon24-Jan-07 22:36 
GeneralRe: from .NET to src code (and all points between...) Pin
john john mackey26-Jan-07 10:14
john john mackey26-Jan-07 10:14 
AnswerRe: from .NET to src code (and all points between...) Pin
Guffa24-Jan-07 23:19
Guffa24-Jan-07 23:19 
QuestionCan I customize the paper size and print a crystal report Pin
indian14323-Jan-07 17:57
indian14323-Jan-07 17:57 
QuestionIs .Net 2.0 is backward compatible with .Net 1.1? Pin
Sunil Jampa23-Jan-07 17:17
Sunil Jampa23-Jan-07 17:17 
AnswerRe: Is .Net 2.0 is backward compatible with .Net 1.1? Pin
Christian Graus23-Jan-07 17:33
protectorChristian Graus23-Jan-07 17:33 
QuestionRe: Is .Net 2.0 is backward compatible with .Net 1.1? Pin
Sunil Jampa23-Jan-07 18:08
Sunil Jampa23-Jan-07 18:08 
AnswerRe: Is .Net 2.0 is backward compatible with .Net 1.1? Pin
Christian Graus23-Jan-07 18:16
protectorChristian Graus23-Jan-07 18:16 
QuestionRe: Is .Net 2.0 is backward compatible with .Net 1.1? Pin
Sunil Jampa23-Jan-07 18:48
Sunil Jampa23-Jan-07 18:48 
AnswerRe: Is .Net 2.0 is backward compatible with .Net 1.1? Pin
Tim Paaschen23-Jan-07 19:29
Tim Paaschen23-Jan-07 19:29 
AnswerRe: Is .Net 2.0 is backward compatible with .Net 1.1? Pin
Rudolf Jan25-Jan-07 1:16
Rudolf Jan25-Jan-07 1:16 

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.