Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it safe to assume?
Message
From
10/08/2005 10:32:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01039853
Message ID:
01039866
Views:
12
>In general I know the answer to the question in the title is no, but considder this case.
>
>The code:
>
>byte[] ba = new byte[24];
>
>creates an array of bytes. Is it safe to assume that all the elements in the byte array are equal to 0x00? I recall from C and unmanaged C++ that is was common to loop through the array after it was declared and initialized and set all the elements to 0x00.
>
>Thanks,
>Einar

By language definition:
"Elements of arrays created by array-creation-expressions are always initialized to their default value".

byte is an integral type with a default value of 0. So yes it's safe to assume all elements eual to 0x00.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform