Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it safe to assume?
Message
De
10/08/2005 12:17:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01039853
Message ID:
01039905
Vues:
19
>>>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
>>
>>As far as I have seen, C# is very strict in the "definite assignment rule". This means that if you add the following code:
>>
>>
>>byte[] ba = new byte[24];
>>xyz = ba[3]
>>
>>
>>if the compiler doesn't complain (about using an un-assigned variable), then it is probably safe.\
>
>Hilmar,
>That is a good test. I am convinced. Thanks.
>
>Einar

Hey does it mean 'language specification' didn't convince you:)
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform