Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / November 2005

Tip: Looking for answers? Try searching our database.

Compatibility relation for "native int"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 06 Nov 2005 23:59 GMT
I'm interested in the compatibility relation (used by the bytecode verifier)
which involves the type "native int".

So, is int32 compatible with native int? i.e. is int32 a subtype of native
int?

The few examples I run show that the bytecode verifier accepts an "int32"
where a "native int" is expected.

The same question also for int64: is int64 a subtype of native int?

Many thanks for any answer.
Richard Grimes - 07 Nov 2005 13:57 GMT
> I'm interested in the compatibility relation (used by the bytecode
> verifier) which involves the type "native int".
[quoted text clipped - 8 lines]
>
> Many thanks for any answer.

The ECMA spec says 'these types exist as CLI types, but the CLI maps
each to the native size for a specific processor' (Partitian 1, 12.1.1).
So although native int is the same as int32 on x86, it may not be the
same on another priocessor. It's like the difference between int and
__int32 in C++

Richard
Signature

http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

George - 07 Nov 2005 14:50 GMT
> The ECMA spec says 'these types exist as CLI types, but the CLI maps
> each to the native size for a specific processor' (Partitian 1, 12.1.1).

I'm aware of this.

It's not clear to me why the bytecode verifier accepts int32 or int64 where
an native int is expected. Does this mean that the verifier considers int32
and int64 compatible with native int?
Richard Grimes - 07 Nov 2005 16:23 GMT
>> The ECMA spec says 'these types exist as CLI types, but the CLI maps
>> each to the native size for a specific processor' (Partitian 1,
[quoted text clipped - 4 lines]
> It's not clear to me why the bytecode verifier accepts int32 or int64
> where an native int is expected.

Well, according to the spec int32 should be accepted on a processor
where ints are 32-bits and in64 should be accepted on a processor where
ints are 64-bits. Are you saying that on x86 the verifier will accept
int32 or int64? If so, then that is a serious bug.

> Does this mean that the verifier
> considers int32 and int64 compatible with native int?

Only on the respective processors. It shouldn't accept either on the
same processor. Do you have examples of what you are talking about?

Richard
Signature

http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

George - 07 Nov 2005 21:28 GMT
It's not clear to me that the verification is arhitecture dependent ...

> Do you have examples of what you are talking about?

yes,

ECMA, Partition III, chapter 3.18: "The brtrue instruction transfers control
to target if value (of type native int) is nonzero (true)." However, the
verifier accepts also values of types "int32" and "int64".

both fragments are accepted by the verifier:

ldc.i4 2
brtrue target

ldc.i8 2
brtrue target

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.