• Print

Author Topic: C++ TO QB64 Coverter Program - Request!  (Read 514 times)

Mrwhy

  • Hero Member
  • *****
  • Posts: 2272
  • My Dad called me Mr Why when I was 5.
Re: C++ TO QB64 Coverter Program - Request!
« Reply #15 on: November 28, 2011, 04:00:27 AM »
Quote from: mcalkins on November 21, 2011, 10:29:45 PM
C++ has advanced features that lack any good counterpart in BASIC. Remember that C++ directly supports things like classes, inheritance, function and operator overloading, and exceptions (somewhat similar to error trapping in QBASIC). As primarily a procedural language, C would be closer, but even C has things QB64 currently doesn't directly support, such as unions.

QB64 does have partial pointer support, but it isn't complete, as it currently lacks built in ability to dereference them.


Michael, the great thing MISSING in all languages is they NEVER SAY what USE their "advanced features" are!
Even QB64 suffers this way, leaving newbies to "find out for themselves" - almost as though "The HARD way - like I did!" Some kind of punitive apprenticeship during which we hope they "go away and stop bothering us". They do!

Here you mention
classes
inheritance
function and operator overloading
exceptions
unions
some lack of pointer support

In WHAT APPLICATIONS would we want to USE them: how do we find out what they are FOR!
What does BASIC lack from not having these?

QB64 could be vastly improved if we could make CLEAR what use its advanced features are.

OlDosLover

  • Hero Member
  • *****
  • Posts: 2591
  • OlDosLover
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #16 on: November 28, 2011, 05:48:11 AM »
Hi all,
    Find a tutorial on C or C++ to learn those terms meanings. A google search will return plenty.
OlDosLover.

Mrwhy

  • Hero Member
  • *****
  • Posts: 2272
  • My Dad called me Mr Why when I was 5.
Re: C++ TO QB64 Coverter Program - Request!
« Reply #17 on: November 28, 2011, 06:16:30 AM »
Oldos, please!  ;D  Their USES not their "meanings"

OlDosLover

  • Hero Member
  • *****
  • Posts: 2591
  • OlDosLover
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #18 on: November 28, 2011, 06:38:33 AM »
Hi all,
    You'll find their USES as well as their MEANINGS in the tuts. Lots tuts come with example code.
OlDosLover.

Mrwhy

  • Hero Member
  • *****
  • Posts: 2272
  • My Dad called me Mr Why when I was 5.
Re: C++ TO QB64 Coverter Program - Request!
« Reply #19 on: November 28, 2011, 06:44:39 AM »
Thanks Oldos

mcalkins

  • Sr. Member
  • ****
  • Posts: 482
    • qbasicmichael.com
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #20 on: November 28, 2011, 12:43:01 PM »
http://www2.research.att.com/~bs/bs_faq.html
http://www2.research.att.com/~bs/bs_faq2.html
http://www2.research.att.com/~bs/ieee_interview.html
http://cplusplus.com/

One tutorial for C is The C Programming Language, 2nd edition, by Brian Kernighan and Dennis Ritchie. Also, Bjarne Stroustrup has books for C++.

Also, the MSDN library has code examples.

Wikipedia and Google are your friends.

Feel free to post at:

http://www.network54.com/Forum/613583/

When posting at Network54, be mindful that whitespace is lost unless you convert it into NBSP characters (Unicode: 0x00a0). Also, if you check, "enable formatted text", it can screw up your code.

>What does BASIC lack from not having these?

In some cases, not much, I think. But it's very much a matter of perspective. For example, there was a thread not too long ago in which DeeBee wanted nested functions. He saw value in them, whereas I and others don't feel the need. So it's very much a matter of perspective and personal preference. If you've never used classes, it's easy to say that they aren't needed, as indeed, they aren't. But they might be helpful, especially to people who are used to them. I would say the one thing in that list that I feel is truly needed is pointers, as so much depends on them. The pointer support that QB64 version 0.942 added over 0.936 made it easier for me to use the Win32 API.

I'm not really in a position to accurately explain the usage of most of those features that I listed in that other post. I could explain pointers and unions. I have already partially discussed pointers and unions in this thread:

http://www.qb64.net/forum/index.php?topic=4527.0

If you want personalized help, I'd suggest posting questions in the C/C++ forum at Network54 (URL above). There are people there, for example, ChronoKitsune and ComputerGhost, who are skilled and knowledgeable.

Regards,
Michael

P.S. I could take a stab at explaining function overloading. I believe function overloading has to do with giving several functions, to handle different data types, the same name. For example, one function might handle an integer data type, while another with the same name might handle a floating point data type. From the perspective of the C++ source code, the two functions have the same name. However, the C++ compiler will give different name mangling to the functions, so that they don't conflict at a low level.

As a QBASIC example, think of STR$(). It accepts a parameter than can be either integer or floating point, even though they are not compatible. So, I would think that there must be at least 2 STR$() functions, one that accepts an integer, the other that accepts a float, but they both use the same name in QBASIC.

PRINT is another QBASIC example, PRINT can accept strings, integers, and floats, at least 3 incompatible data types. Whether things like that are actually implemented as overloaded functions, or by some other means, I don't know. (Ethan Winer's book would probably say.) However, I prefer to think of them as overloaded functions.
« Last Edit: November 28, 2011, 01:34:29 PM by mcalkins »

Mrwhy

  • Hero Member
  • *****
  • Posts: 2272
  • My Dad called me Mr Why when I was 5.
Re: C++ TO QB64 Coverter Program - Request!
« Reply #21 on: November 28, 2011, 10:04:56 PM »
Quote from: mcalkins on November 28, 2011, 12:43:01 PM

>What does BASIC lack from not having these?

In some cases, not much, I think. But it's very much a matter of perspective. For example, there was a thread not too long ago in which DeeBee wanted nested functions. He saw value in them, whereas I and others don't feel the need. So it's very much a matter of perspective and personal preference. If you've never used classes, it's easy to say that they aren't needed, as indeed, they aren't. But they might be helpful, especially to people who are used to them. I would say the one thing in that list that I feel is truly needed is pointers, as so much depends on them. The pointer support that QB64 version 0.942 added over 0.936 made it easier for me to use the Win32 API.

I could take a stab at explaining function overloading. I believe function overloading has to do with giving several functions, to handle different data types, the same name. For example, one function might handle an integer data type, while another with the same name might handle a floating point data type. From the perspective of the C++ source code, the two functions have the same name. However, the C++ compiler will give different name mangling to the functions, so that they don't conflict at a low level.

As a QBASIC example, think of STR$(). It accepts a parameter than can be either integer or floating point, even though they are not compatible. So, I would think that there must be at least 2 STR$() functions, one that accepts an integer, the other that accepts a float, but they both use the same name in QBASIC.

PRINT is another QBASIC example, PRINT can accept strings, integers, and floats, at least 3 incompatible data types. Whether things like that are actually implemented as overloaded functions, or by some other means, I don't know. (Ethan Winer's book would probably say.) However, I prefer to think of them as overloaded functions.

Thank you very much Michael for such a thoughtful and helpful reply: one of the best I have ever read. (I quote the best bits)

Where QB64 suffers is in not adequately explaining how USEFUL its functions are and thus ATTRACTING new users. To do this speak THEIR language: don't just TELL them how to CODE (what syntax to use): that drives them away. They need that AFTER they realise that they WANT to use it!

I DID try "function and operator overloading" in Google and true there is LOTS of stuff.
But it ALL fails to point out that "overloading" is now a completely new (undefined) word NOTHING to do with its use in the English language (tending to break down or overheat due to excessive work)
Also operator can mean "User: the person using" or "Thing: the device performing the act"
Function is a VERB!
The problem with these "explanations" is every word is jargon, defined via more jargon, leading one to suspect that the basic idea is to "retain expert status" by EXCLUDING newcomers! ;D
Yet the GREATEST thing about QB64 is it CAN make it easy to be understood "in English".
So every time it doesn't a huge opportunity is lost
« Last Edit: November 28, 2011, 10:27:37 PM by Mrwhy »

Clippy

  • Hero Member
  • *****
  • Posts: 11938
  • I LOVE π = 4 * ATN(1) Use the QB64 WIKI >>>>>>>>>
    • Pete's Qbasic Site
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #22 on: November 28, 2011, 10:29:54 PM »
QB64 does not suffer! YOU suffer from the same old TIRED complaints about everything from your sense of hearing to the theory of relativity. Everything overwhelms you because you want it that way.

vrensul

  • Sr. Member
  • ****
  • Posts: 319
  • 44th Degree Digital Wizard of the HighBytes Order
Re: C++ TO QB64 Coverter Program - Request!
« Reply #23 on: November 28, 2011, 10:36:05 PM »
Quote
P.S. I could take a stab at explaining function overloading. I believe function overloading has to do with giving several functions, to handle different data types, the same name. For example, one function might handle an integer data type, while another with the same name might handle a floating point data type. From the perspective of the C++ source code, the two functions have the same name. However, the C++ compiler will give different name mangling to the functions, so that they don't conflict at a low level.

Just to add to that statement, Function Overloading can also allow multiple different sets of the same function with a different parameter set.

For example:
Code: [Select]
' In qb64, if it had function overloading you could:
FUNCTION ReturnVal! (Val1 as INTEGER, Val2 as INTEGER)

FUNCITON ReturnVal$ (Val1 as INTEGER, Val2 as INTEGER)

FUNCTION ReturnVal$ (Val1 as INTEGER, Val2 as INTEGER, Val3 as INTEGER)

I wish that QB64 did allow function overloads but I'm sure it's "not in the plans" as it's not part of the QB4.5 language.  Aside from that, I could speculate that it would take a lot of work on the QB64 compiler to make that happen.
' With programming, you  can do anything!
DEF SEG = &HBANKACNT 'weekend starts here...
     poke checking, 1000000
DEF SEG ' quit job here.

OlDosLover

  • Hero Member
  • *****
  • Posts: 2591
  • OlDosLover
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #24 on: November 29, 2011, 06:51:05 AM »
Hi all,
   
Quote
Where QB64 suffers is in not adequately explaining how USEFUL its functions are and thus ATTRACTING new users. To do this speak THEIR language: don't just TELL them how to CODE (what syntax to use): that drives them away. They need that AFTER they realise that they WANT to use it!

    Attracting new users is most likely newcommers to programing. How many well versed C programmers are going to learn BASIC? And so the "audience" that we have the best opportunity to capture needs demonstrations of what they can do with programming. Most newcommers will be swayed by fancy graphic and 3D as its very appealing to young people. So newcommers dont need technical explanations of functions but demonstrations. Upon seeing and understanding the demonstrations they often ask questions that lead to knowledge increases in their understanding and consolidation. They also do research on their own and experiment with other peoples code.
    If we take the case of a C programmer converting to BASIC he brings with him his current knowledge and often he can see similaritys and differences due to his prior understandings. This sort of programmer would benefiet from explanations of usefulness of functions.

   
Quote
"The problem with these "explanations" is every word is jargon, defined via more jargon, leading one to suspect that the basic idea is to "retain expert status" by EXCLUDING newcomers!
Yet the GREATEST thing about QB64 is it CAN make it easy to be understood "in English".
So every time it doesn't a huge opportunity is lost"

    Computers are a new invention and as such share their vocabruary with more modern recognised way of speech. As an engineer you must have been privy to the engineering words used to describe and explain concepts and ideas that are used in those text books. Now its possible that there are text books that offer "layman" terms like the "Dummy's series of books". Take medicine and it vocalbury of greek and latin. Surely if not versed in those ancient languages one would consider that jargon! Imagine medicine in plain english! Would it be accurate enough to competently describe the message that needs to convey? I'm not qualified to comment unfortunetly. Each year 100's of new words are added to dictionarys as they represent the common terms that modern people now use. Its true that some "jargon" is described by more jargon. Try to have a conversation with any teenager and you will see it clearly. Is it jargon , slang or something different? Well its their choice of words and its not done to exclude me but rather they find it more representative to deliver messages with to each other.
    The wiki could be written hundereds of different ways and we still couldn't reach everyone. The answer here to me its the newcommers responsibility to research and learn (even the jargon) and once understood and comprehended then they have a choice of how to express what it is they wish to express. They will then even have a choice of the vocalbury they decide to use.
    So respectfully i ask you to compose a "laymans" manual that explains all of this "jargon" so that anyone will come to understand what it is that is being talked about after they read your manual. Once you prove your point then i will gladly adopt the fruits of your work.
OlDosLover.

Clippy

  • Hero Member
  • *****
  • Posts: 11938
  • I LOVE π = 4 * ATN(1) Use the QB64 WIKI >>>>>>>>>
    • Pete's Qbasic Site
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #25 on: November 29, 2011, 07:54:40 AM »
I have started on some terminology, but I am sure you all can suggest more. Just ask...

http://qb64.net/wiki/index.php?title=Syntax_Notation_Conventions#Programming_Acronyms_and_Terminology

A.R.B

  • Sr. Member
  • ****
  • Posts: 466
Re: C++ TO QB64 Coverter Program - Request!
« Reply #26 on: November 29, 2011, 09:58:42 AM »

Here is Some Useful Terminology! "The button to the right of the # CODE button puts quotes inside of a box too..."


A.R.B
Knew That We Ventured On Such Dangerous Seas
That If We Wrought Out Life 'Twas Ten To One.

William Shakespeare, Henry IV, Part II, Act I, Scene 1 lines 181–2.
----------------------------------------------------------------------
Jesus Crucified By His Own Kind! Is Proof of How Bad! They Were! Are!

mcalkins

  • Sr. Member
  • ****
  • Posts: 482
    • qbasicmichael.com
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #27 on: November 29, 2011, 05:06:21 PM »
I'm getting off the subject just a bit, but just I wanted to point out that not all cases of functions with variable numbers or types of parameters are instances of overloading.

For example, C's printf accepts a variable number of parameters of various types. However, there is only one printf. C allows CDECL functions to have an indefinite number and type of parameters.

int printf ( const char * format, ... );

The first parameter is a pointer to a string. The contents of the string tell printf what the remaining parameters are. I think the ... tells the C compiler not to enforce any restrictions on the remaining parameters.

At a low level, the CDECL name mangling of printf is "_printf", without any indication about the parameters, like there would be with STDCALL name mangling. (I am unfamiliar with the details of C++ name mangling, other than that it is crucial to C++ function overloading.) The first parameter is at a known location on the stack, EBP+8. With CDECL, the caller clears the stack, so the number of parameters does not need to be hard coded into the function, the way it would be with STDCALL.

I say this to point out that not all cases of variable numbers and types of parameters are instances of overloading.

Regards,
Michael

OlDosLover

  • Hero Member
  • *****
  • Posts: 2591
  • OlDosLover
    • Email
Re: C++ TO QB64 Coverter Program - Request!
« Reply #28 on: November 30, 2011, 05:23:35 AM »
Hi all,
    Im flabbergasted! Thank you Clippy! Once again you have proved that the wiki deserves only the best efforts that men can make.
OlDosLover.

A.R.B

  • Sr. Member
  • ****
  • Posts: 466
Re: C++ TO QB64 Coverter Program - Request!
« Reply #29 on: December 01, 2011, 02:27:08 AM »

What about Woman! OlDosLover & Pets Etc. :)


A.R.B
Knew That We Ventured On Such Dangerous Seas
That If We Wrought Out Life 'Twas Ten To One.

William Shakespeare, Henry IV, Part II, Act I, Scene 1 lines 181–2.
----------------------------------------------------------------------
Jesus Crucified By His Own Kind! Is Proof of How Bad! They Were! Are!

  • Print