[Gambas-user] VB to Gambas conversion question

Emil Lenngren emil.lenngren at ...626...
Sat Jul 28 21:24:21 CEST 2012


You should write "Dim t As New Float[25]" instead of "Dim t[25] As Float"
if you don't have special reasons.

/Emil

2012/7/28 wally <wally at ...2037...>

> Thank you very much.
>
> so if i use
> VB:             ReDim t#(0 To 25)
> GB:     Dim t[25] as Float
>
> VB: If (i < 10) Then t(I) = 0#
> GB: If(i < 10) then t[i] = 0.0
>
> all will be nice, correct ?
>
>
>
> On Saturday 28 July 2012 15:10:17 nando wrote:
> > Not a cast
> > It is Forced Double at compile time.
> >
> > 0 is usually interpreted when compiled as 0 (integer)
> > 0.0 would be interpreted as non-integer
> > 0# same thing but forces the representation as double.
> >
> > Reason behind doing this:
> >
> > if you have a double array t#(0..25)
> >
> > when you do
> >
> > t#(I) = 0
> >
> > The zero compiles to an integer.
> > at RUNTIME, it has to convert to double....which takes more cpu cycles.
> >
> > So, 0# forces the compile to a double..at compile time.
> > at RUNTIME, no convesion....less cpu cycles.
> >
> > It would make a difference with many converstions over a long time
> > or if the program was very intense doing this type of stuff.
> >
> > Smarter compilers would realize the immediate value is being assigned to
> > a double and coerce the immediate to double at compile time.
> >
> >
> > ---------- Original Message -----------
> > From: wally <wally at ...2037...>
> > To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
> > Sent: Sat, 28 Jul 2012 15:36:31 +0200
> > Subject: [Gambas-user] VB to Gambas conversion question
> >
> > > what does "0#" mean in VB ?
> > >
> > > e.g.
> > >
> > > ReDim t#(0 To 25)
> > >
> > > If (i < 10) Then t(I) = 0#
> > >
> > > is this some kind of casting zero to Double ?
> > >
> > > thanks in advance
> > > wally
> > >
> > >
> ------------------------------------------------------------------------
> > > ------ Live Security Virtual Conference
> > > Exclusive live event will cover all the ways today's security and
> > > threat landscape has changed and how IT managers can respond.
> > > Discussions
> > > will include endpoint security, mobile security and the latest in
> > > malware
> > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > ------- End of Original Message -------
> >
> >
> >
> ----------------------------------------------------------------------------
> > -- Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list