old code and new compiler versions

For other topics related to the FreeBASIC project or its community.
BasicCoder2
Posts: 3738
Joined: Jan 01, 2009 7:03
Location: Australia

old code and new compiler versions

Postby BasicCoder2 » Jun 10, 2021 9:44

From thread that i didn't want to hyjack,
viewtopic.php?f=2&p=283456#p283456
jj2007 wrote:
BasicCoder2 wrote:Nothing annoys me more than wanting to update or edit FB code I wrote 11 years ago and having to modify it to work with the latest incarnation of FreeBASIC.
Ever tried to compile a C/C++ snippet found on the web that was written more than 2 years ago? Have fun...


Indeed I have. Over a decade ago before finding FreeBASIC I bought a few books on programming games in C++. Two came with a dvd with the DevC++ IDE that the books used and one with MASM. All their examples worked great. Five years later after playing with FreeBASIC I thought I would go back and do some C++ programming. None of the source code would compile (I was using the CODE::BLOCKS IDE, no idea what c++ compiler came with it). So the books and DVD examples were now rubbish so I threw them out and returned to FreeBASIC.

Some old 2006 FreeBASIC code started with OPTION EXPLICIT
error 146: Only valid in -lang deprecated or fblite or qb, found 'OPTION' in 'OPTION EXPLICIT'
Removing the directive still gave errors,

error 147: Default types or suffixes are only valid in -lang deprecated or fblite or qb in 'declare function GetVerticeType(image1() as ubyte, x as integer, y as integer)'

So on some old 2006 code I have to go through and change,

for y = 0 to iHEIGHT - 1

to

for y as integer = 0 to iHEIGHT - 1

or,

declare function GetVerticeType(image1() as ubyte, x as integer, y as integer)

to

declare function GetVerticeType(image1() as ubyte, x as integer, y as integer) as integer

Cost of improving computer languages I guess.
fxm
Moderator
Posts: 10369
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: old code and new compiler versions

Postby fxm » Jun 10, 2021 11:02

You can still try to compile this old type of code with the "fblite" dialect.
BasicCoder2
Posts: 3738
Joined: Jan 01, 2009 7:03
Location: Australia

Re: old code and new compiler versions

Postby BasicCoder2 » Jun 10, 2021 12:28

@fxm
Sure but if you want to cut/paste or include source code with new source code the old source code has to be rewritten and I found that a real chore.
The same problem with Python 2 vs Python 3 source code.
The same problem I think with the original discussion about learning QBASIC and then having any good QBASIC source code unusable by FreeBASIC without some kind of conversion to the new syntax. It is something we have to live with but if you want to learn say Python it would make more sense to start with the latest Python 3 not Python 2. Or use the latest C++ compiler if you are a beginner in C++. Essentially the same problem of needing to rewrite any source code developed in one language into another language.
badidea
Posts: 2333
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: old code and new compiler versions

Postby badidea » Jun 10, 2021 21:26

BasicCoder2 wrote:Cost of improving computer languages I guess.

If breaking code is not allowed, then a language can not progress at a certain point.

You can keep older versions of the freebasic compiler on your computer, for this but that might give problems later.
E.g. when Windows 11 is released and happens to stop support for 32-bit software.
jj2007
Posts: 2142
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: old code and new compiler versions

Postby jj2007 » Jun 10, 2021 22:06

BasicCoder2 wrote:The same problem with Python 2 vs Python 3 source code.
That is one of the most horrible cases of nerd arrogance. The print "hello World" vs print("hello World") mess alone yields a Million hits on Google: "Python 3" "Python 2" "print"
badidea wrote:when Windows 11 is released and happens to stop support for 32-bit software.
I was seriously hit myself by the end of 16-bit software. The end of 32-bit software, however, is far. M$ could get rid of 16-bit software because 90% was slow, old and crappy. The case of 32-bit software is different; first, there is no performance difference between 32- and 64-bit code; second, there is simply too much 32-bit software around. They cannot stop it. Plus, there is no need for it. There will be no 128-bit Windows version in the next 20-50 years, simply because 64-bit Windows serves all needs.
mrToad
Posts: 429
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: old code and new compiler versions

Postby mrToad » Jun 12, 2021 21:24

jj2007 wrote: The case of 32-bit software is different; first, there is no performance difference between 32- and 64-bit code; second, there is simply too much 32-bit software around. They cannot stop it. Plus, there is no need for it . . .
Good. I like major updates for anything (especially OS) when it is completely reasonable and appropriate, and simply problematic and unreasonable otherwise. This was true when 16-bit went to 32-bit. But the idea of discontinuing 32-bit, well - I sure hope the deciding minds out there are in harmony with yours.

Yet, I fear the principle reason for upgrading things these days - cars, phones, TVs, gadgets of all kinds - seems to be getting profoundly stupid. Of course, with the lack of questions, the absence of thoughtful inquiry - what do you mean 'reason?' It's new, so that means what you have is old. Obviously, this is a critical matter.

Product creators know that the noblest cause for upgrading a thing, is that it's been awhile. They will be sure to help you understand how vital it is that you replace that old thing with their new thing - how much you need it, should already have it! 64-bit OS? Oh no, no - old technology. The world has moved on to 128-bit now. Well, of course you knew that - you'd have to be living under a rock not to know that!

So here you go, take what you came for, and experience the exquisite joy of possessing the latest. Go be proud and show everyone what you have attained; feel the purely-imaginative difference such a thing makes in your life, the deep satisfaction and pride in keeping up with the world's commercially-inspired pursuit of fulfillment, how short and shallow the thrill is; and please know that we are here to help you keep reaching out for the best - as long as it is to us that you reach out - and that you are sure to have the correct amount of money in your hand. Have a blessed day.
Last edited by mrToad on Jun 12, 2021 22:10, edited 1 time in total.
mrToad
Posts: 429
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: old code and new compiler versions

Postby mrToad » Jun 12, 2021 21:28

Just having a little fun with the imagination there. Hopefully things will go better than that :)
-mrToad
jj2007
Posts: 2142
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: old code and new compiler versions

Postby jj2007 » Jun 13, 2021 7:29

You made my day, mrToad - thanks ;-)
D.J.Peters
Posts: 8297
Joined: May 28, 2005 3:28
Contact:

Re: old code and new compiler versions

Postby D.J.Peters » Jun 14, 2021 15:39

mrToad professional solutions needs more and more bits and power so nothing is wrong with 64 or 128 bit systems in general.

The problem for manufacturers are, producing 16, 32, 64, 128 or 256 bit systems parallel, doubles the costs in many reasons !

Of course using 1000 GPUs with 256 bit buses and terabyte of RAM only for bitcoin hashing makes no sense !
(the only real value behind it are the consume of massive power, no rare metals like GOLD or manpower)

How ever solving open questions in physics 256 bit systems or better quantum computers are the key :-)

Joshy

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 6 guests