Initialization of structs. The old way memset(str, sizeof(str), 0) is disregarded. 
Author Message
 Initialization of structs. The old way memset(str, sizeof(str), 0) is disregarded.

Hej

C# warns when the code is using un initialized structs. This can happend
several time.

In mycase I have implement a COM method of an interface.

void Data([In, Out] out veryComplexStruct) ...

Normally the method sets the fields of the structure and leave it changed to
the callee.
But the compiler complaines about that specific error.
I could use #pramga for disable that error, but I want, Nor memcopy nor
memset.

I want to use a C# constructs, or an Attribute constructs that tells the
compiler to no worry or that is already initialized.
compare. I will not say that I can call the method with some of the values
set to any apropriate value, thay should all be zero, thats all.

explicit ((uint) 0x80000000);

best recards Roland
Baltic Sea.



Tue, 21 Dec 2004 07:14:50 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. char **str vs. char *str[]

2. _T(str) vs (CString)str?

3. char *str vs. char str[]

4. Dialogs: m_myCtrl.GetWindowText(str) or GetDlgItemText(IDC_MY_CTRL, str)?

5. c standard regarding char str[ ], str[50] & *str

6. sizeof (struct) ! = sizeof struct elements

7. Is i = *(int*) *str; /*char* str */ defined?

8. char *str = "a string"; str = "another string"

9. ANN: C++ Str Library updated to 2.1.2

10. Str size to use for temp string

11. Basic Question - char *str V/S int *

12. str function prob

 

 
Powered by phpBB® Forum Software