CType(b,Integer)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: CType(b,Integer)

  1. #1
    Kathleen Dollard-Joeris Guest

    CType(b,Integer)

    Because Larry, Bob, et al's discussion was buried in the Bad Programming
    Practices thread, this is the word I got from MS on CType

    > > > "CInt(b)" is a shortcut for saying "CType(b, Integer)"
    > > > Their behavior is identical. That is, CInt(True) = CType(True,

    Integer)
    > > > = -1.
    > > >


    --
    Kathleen
    (MS-MVP)
    Reply in the newsgroup so everyone can benefit
    --



  2. #2
    Gregor R. Peisker Guest

    Re: CType(b,Integer)

    Hi Kathleen,

    > Because Larry, Bob, et al's discussion was buried in the Bad Programming
    > Practices thread, this is the word I got from MS on CType
    >
    > > > > "CInt(b)" is a shortcut for saying "CType(b, Integer)"
    > > > > Their behavior is identical. That is, CInt(True) = CType(True,

    > Integer)
    > > > > = -1.


    Just to sure on this, this is about Beta 2 and future versions, right? So
    CType would behave exactly like CInt()?

    Thanks,
    Gregor




  3. #3
    Bob Butler Guest

    Re: CType(b,Integer)


    "Kathleen Dollard-Joeris" <kjoeris@noemailplease.com> wrote in message
    news:3adba4e6@news.devx.com...
    > Because Larry, Bob, et al's discussion was buried in the Bad Programming
    > Practices thread, this is the word I got from MS on CType
    >
    > > > > "CInt(b)" is a shortcut for saying "CType(b, Integer)"
    > > > > Their behavior is identical. That is, CInt(True) = CType(True,

    > Integer)
    > > > > = -1.


    Interesting. Does this imply that it'd be more efficient to just call CType
    directly or does the compiler substitute CType for CInt?




  4. #4
    Jonathan West Guest

    Re: CType(b,Integer)


    "Gregor R. Peisker" <gregor@peisker.de> wrote in message
    news:3adc22ad@news.devx.com...
    > Hi Kathleen,
    >
    > > Because Larry, Bob, et al's discussion was buried in the Bad Programming
    > > Practices thread, this is the word I got from MS on CType
    > >
    > > > > > "CInt(b)" is a shortcut for saying "CType(b, Integer)"
    > > > > > Their behavior is identical. That is, CInt(True) = CType(True,

    > > Integer)
    > > > > > = -1.

    >
    > Just to sure on this, this is about Beta 2 and future versions, right? So
    > CType would behave exactly like CInt()?


    That is my understanding, yes.

    --
    Regards
    Jonathan West


  5. #5
    Kathleen Dollard-Joeris Guest

    Re: CType(b,Integer)

    Gregor,

    > Just to sure on this, this is about Beta 2 and future versions, right? So
    > CType would behave exactly like CInt()?


    That was the answer I got. Yes.

    --
    Kathleen
    (MS-MVP)
    Reply in the newsgroup so everyone can benefit
    --



  6. #6
    Kathleen Dollard-Joeris Guest

    Re: CType(b,Integer)

    Bob,

    > Interesting. Does this imply that it'd be more efficient to just call

    CType
    > directly or does the compiler substitute CType for CInt?
    >

    Since it is not yet available, do you think we can just wait for beta2 and
    look at the IL? It would be my expectation that they would come up with the
    same IL.

    --
    Kathleen
    (MS-MVP)
    Reply in the newsgroup so everyone can benefit
    --



  7. #7
    Bob Butler Guest

    Re: CType(b,Integer)


    "Kathleen Dollard-Joeris" <kjoeris@noemailplease.com> wrote in message
    news:3adc5918@news.devx.com...
    > Bob,
    >
    > > Interesting. Does this imply that it'd be more efficient to just call

    > CType
    > > directly or does the compiler substitute CType for CInt?
    > >

    > Since it is not yet available, do you think we can just wait for beta2 and
    > look at the IL? It would be my expectation that they would come up with

    the
    > same IL.


    Definitely -- just wondering if your info specified and you were free to
    disclose. I did look at the beta 1 version and it looks to me like both
    CInt(boolean) and CType(boolean,Int32) compile to identical in-line IL code.
    I'm not sure how it could be said that CInt is a "shortcut for CType" in
    that case unless it's how the compiler handles it.

    I'm sure it'd be possible for them to be different but I'm guessing that it
    makes it easier inside the compiler logic to have them the same. As I said
    before, since CType is new syntax I can see good arguments for all three
    alternatives (-1, +1, error) and don't really care which it is.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center