• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Alternative migration path

Started by James C. Fuller, October 03, 2013, 04:00:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

James C. Fuller

I agree with Patrice that any migration path from PowerBASIC should be to c++ (if you really think you need to migrate(?)

As a BASIC coder for almost 40 years I am not comfortable with the c++ nomenclature. I LIKE BASIC!
That is why I have spent so much time with my fork of BCX -> bc9Basic.

I have ported a few apps from PowerBASIC to bc9Basic without too many problems.

I have just Updated bc9Basic to ver 9.1.6.4: http://bc9.bcxbasic.com/
See the October 03 news.


For those who might want to take a look without a download here is a link to an online version of the BCX help file.
This is not the current version from the Yahoo Group site but is quite relevant to both BCX and bc9Basic.

http://www.bcxbasic.com/webhelp/BCXHelp.htm

James

Edwin Knoppert

I think bcx is a great free tool, i even implemented bcx into PwrDev once (but never released it)
A bit sad is the need for gathering compilers and stuff (even while it may be a single setup?)
This makes it indeed an 'alternative' (as in non-standard)

Patrice Terrier

#2
James--

QuoteI agree with Patrice that any migration path from PowerBASIC should be to c++

I think that with the help of macro, and encapsulation, we could create a BASIC like around C++, that would work directly with Visual Studio, using #include "Basic.h" :)

Even the nasty {} could be converted like this:

#define XOR ^
#define OR |
#define MOD %
#define Then {
#define EndIf }
#define EndSelect }
#define Next }
#define Wend }
#define EndLoop }
etc...

Added: And, of course, no more need to translate the headers...  8)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Mike Stefanik

Mike Stefanik
sockettools.com

Brice Manuel

BASIC is not inherently bad, what is bad about BASIC is the various languages are generally put out by indie developers or mom and pop businesses and the lifespan of the languages are usually very short.  They either get abandoned, or they implode from feature creep and stop being BASIC.

C/C++ is a logical migration path as long as you avoid Visual Studio.

Patrice Terrier

Quoteas long as you avoid Visual Studio

Why?

Visual Studio has helped me to find bugs i could never find without it.
Also it is amazing to see how somes bugs are detected in 64-bit mode that are not detected in 32-bit, probably because of the use of LONG_PTR.

And when using the correct parameters VS can produce very small, fast, and optimized code as long as using pure SDK coding style (no MFC, no ATL, no OOP, no .NET). Indeed i can produce smaller and faster code than with PB, and i can use all the latest technologies which is a mandatory for the kind of job i am doing.

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Brice Manuel

Quote from: Patrice Terrier on October 05, 2013, 09:26:32 AM
Why?

It is not portable, it is Windows-only.  It does not always follow ISO standards.


Quote from: Patrice Terrier on October 05, 2013, 09:26:32 AMAnd when using the correct parameters VS can produce very small, fast, and optimized code as long as using pure SDK coding style (no MFC, no ATL, no OOP, no .NET). Indeed i can produce smaller and faster code than with PB, and i can use all the latest technologies which is a mandatory for the kind of job i am doing.

Much of PowerBASIC's competition can produce smaller code than PB, and often faster.  PB became bloated over the last two versions.

James C. Fuller

Patrice,
  No OOP? What is your definition of OOP as my definition would include the STL.
  I second no Visual Studio especially 2010, which I believe you said you were using.
The c++11 implmentation is not complete.

For size the probable explanation is VC++ uses Windows dlls where I know MinGW uses static libraries.

If you don't want oop and the smallest size then use Tiny c 0.9.26.

==============================================================================

Tom & Brice,
  I probably should rename bc9Basic the NOT BASIC BASIC. It is what I want. c++ with basic syntax.
And, it is NOT for beginners.

James

Patrice Terrier

As long as i am targeting the Windows Platform, then i will use the same compiler than the one used to write this OS.
8)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Mike Stefanik

Quote from: James C. Fuller on October 05, 2013, 02:03:43 PM
The c++11 implmentation is not complete.

In the context of Windows programming, to that I would throw out a big yawn. There are certainly things that are convenient (initializer lists, static asserts, etc.) but there's nothing there that translates into some massive productivity gain. The multi-threading, concurrency, Unicode support and so on are already handled in different ways in Windows, and things like extra modes for fopen() and the secure standard I/O functions already exist in Visual C++. If he were trying to write portable, cross-platform code using only the standard libraries, that would be one thing. He's not, he's isn't and therefore it really doesn't impact him in any significant way.
Mike Stefanik
sockettools.com

James C. Fuller

#10
 
I don't know if VS 2010 will compile this but VC++ from the Win7 SDK will not.

I find auto for iterators and range based for loops two of my fav's

James



#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main ()
{
  vector<wstring>  s={L"one",L"two",L"three",L"four",L"five"};
  cout << "s contains" << endl;
  for(auto it=s.begin();it!=s.end();++it)
    {
      wcout << " " << *it;
    }

  cout << endl;
  cout << "in reverse" << endl;
  for(auto rit=s.rbegin();rit!=s.rend();++rit)
    {
      wcout << " " << *rit;
    }

  cout << endl;
  cout << "range-based for loop" << endl;
  for ( auto it : s)
    {
      wcout << " " << it;
    }

  cout << endl;
  cout << "sort it " << endl;
  std::sort(s.begin(),s.end());
  for ( auto it : s)
    {
      wcout << " " << it;
    }

  cout << endl;
  system("pause");
  return 0;
}




And this is the bc9Basic code:

'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'vector using c++11 reference-based for loops, auto, and const iterators
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

$CPP
$NOMAIN


$ONEXIT "MINGWGPP.BAT $FILE$ -m32 con"
'$ONEXIT "VC.BAT $FILE$ -m32 con"
$HEADER
  #include <iostream>
  #include <algorithm>
  #include <vector>
  using namespace std;     
$HEADER

Function main() As Integer


'this is new for c11
Raw As vector<wstring> s = {L"one",L"two",L"three",L"four",L"five"}



cout << "s contains" << endl
xFor _auto it = s.begin() While it <> s.end() By ++it
wcout << " " << *it
xNext
cout << endl
'
cout << "in reverse" << endl
xFor _auto rit = s.rbegin() While rit <> s.rend() By ++rit
wcout << " " << *rit
xNext
cout << endl
'
'range based for loop
    cout << "range-based for loop" << endl
RbFor ( _auto it : s)
wcout << " " << it
Next
cout << endl

'sort it
cout << "sort it " << endl
std::sort( s.begin(),s.end())
RbFor ( _auto it : s)
wcout << " " << it
Next

cout << endl
system("pause")
End Function