tiny os虚拟机_当我将Tiny OS从C转换为VBNET阵列长度时,面对问题的微妙之处

tiny os虚拟机

tiny os虚拟机

Top subtle (as a brick in the face) issues when converting my Tiny OS from C# to VB.NET:

将Tiny OS从C#转换为VB.NET时,最细微的问题(表面上是一块砖):

  1. Array Lengths...I knew we were warned, and there were all those arguments from Beta1 to Beta2 to RTM, but still...      byte[] bytes = new byte[4];has length 4, from 0 to 3

    Array Lengths...I knew we were warned, and there were all those arguments from Beta1 to Beta2 to RTM, but still...      byte[] bytes = new byte[4];has length 4, from 0 to 3

    Array Lengths...I knew we were warned, and there were all those arguments from Beta1 to Beta2 to RTM, but still...      byte[] bytes = new byte[4];has length 4, from 0 to 3     Dim bytes(4) As Bytehas length 5, from 0 to 4

  2. 数组长度...我知道我们被警告过,从Beta1到Beta2再到RTM都有所有这些参数,但仍然...

    字节[]字节= 字节[4]; 长度为4,从0到3

    数组长度...我知道我们被警告过,从Beta1到Beta2再到RTM都有所有这些参数,但是仍然...

    字节[]字节= 字节[4]; 长度为4,从0到3

    数组长度...我知道我们被警告过,从Beta1到Beta2再到RTM都有所有这些参数,但仍然...

    字节[]字节= 字节[4]; 长度为4,从0到3个Dim字节(4) 字节长度为5,从0到4
  3. Integer Divison... "/" and "\" are different operators in VB.NET than C#.  "/" doesn't round, while "\" does...

    整数除法... VB.NET中的“ /”和“ \”是与C#不同的运算符。 “ /”不取整,而“ \”不取整...

    Integer Divison... "/" and "\" are different operators in VB.NET than C#.  "/" doesn't round, while "\" does...

    整数除法... VB.NET中的“ /”和“ \”是与C#不同的运算符。 “ /”不取整,而“ \”不取整...

         (uint)(boundary * ((number / boundary) + ((number % boundary > 0) ? 1: 0)))where boundary is 16 and number is 82 returns 96.  While "equivalent (not)" VB.NET     CType(boundary * ((number / boundary) + IIf(number Mod boundary > 0, 1, 0)), Integer)where boundary is 16 and number is 82 returns 98 because (number / boundary) returns 5.25, not 5.  This was fixed by using a backslash.     CType(boundary * ((number \ (BACKSLASH) boundary) + IIf(number Mod boundary > 0, 1, 0)), Integer)This is one of these obvious, silly things you've known since VB3, but you don't think about it when converting from C# to VB.NET. 

    ( uint )(boundary *(((数字/边界)+((数字%边界> 0)?1:0)))其中边界为16且数字为82的返回96。而“等效(非)” VB.NET CType (boundary *(((number / boundary)+ IIf(number Mod boundary> 0,1,0 )), Integer )) ,boundary为16而number为82则返回98,因为(number / boundary) 返回5.25,而不是5。使用反斜杠可以解决此问题。 CType (边界*((数字((BACKSLASH)边界)+ IIf(数字Mod边界> 0,1,0) ),整数)这是自VB3以来您就知道的这些显而易见的愚蠢的事情之一,但您没有从C#转换为VB.NET时不要考虑它。

  4. UInt32 isn't supported in VB, so I had to wimp out and switch to Integers.

    在VB中不支持UInt32,因此我不得不精疲力竭并切换到Integers。

翻译自: https://www.hanselman.com/blog/top-subtle-as-a-brick-in-the-face-issues-when-converting-my-tiny-os-from-c-to-vbnet-array-lengthsi-knew

tiny os虚拟机

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值