Bug in PRINT <positive number>?

Windows specific questions.
BasicJan
Posts: 46
Joined: Aug 30, 2005 20:09
Location: Netherlands

Bug in PRINT <positive number>?

Postby BasicJan » Oct 12, 2005 20:52

If a positive number is converted to a string (STR$(<positive number>) or printed (PRINT <positive number>) in QuickBasic a space is placed before the number.

In FreeBasic no space is added if a positive number is converted to a string (STR$). However, if a positive number is printed, a space is still added!!

Try

PRINT "TEST";100

Was this meant to behave like this, or should there be no space, like the STR$-statement?
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Postby mjs » Oct 12, 2005 20:54

Yes, it's meant to be like this.

Regards,
Mark
urger
Posts: 32
Joined: Jul 30, 2005 22:44

Postby urger » Oct 12, 2005 21:26

This was deliberately changed in FB.
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Postby 1000101 » Oct 12, 2005 22:21

Why?

Just to break things and require people to check for lead spaces?

Stupid reasons people.
v1ctor
Site Admin
Posts: 3801
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Oct 12, 2005 22:56

STR$ works that way since release 0.0, that's listed in the wiki docs as well: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgStr
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Postby mjs » Oct 12, 2005 22:56

It was a design decision v1ctor made. I personally don't care about leading spaces for non-negative numbers.

I guess that v1ctor found this leading space for STR$ annoying and therefore removed it in FB to get rid of the need of the "LTRIM$(STR$(num%))" stuff. However, the leading space is kept when printing numbers to ensure that the output isn't broken when compiling old QB sources with FB.

Regards,
Mark
JJ2005
Posts: 30
Joined: Sep 29, 2005 14:41

Postby JJ2005 » Oct 13, 2005 14:15

mjs wrote:It was a design decision v1ctor made. I personally don't care about leading spaces for non-negative numbers.

I guess that v1ctor found this leading space for STR$ annoying and therefore removed it in FB to get rid of the need of the "LTRIM$(STR$(num%))" stuff. However, the leading space is kept when printing numbers to ensure that the output isn't broken when compiling old QB sources with FB.

Regards,
Mark


Personally I prefer no spaces, and it should be consistent between screen and other outputs. Screen no, printer yes makes no sense.
Inserting a space in old QB sources would be truely cumbersome, though. Imagine a "Print a1;a2;a3" etc. statement...
Best option imho would be an "OPTION LEAD SPACES ON" (default: OFF) for those who rely on QB sources.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 3 guests