Shop OBEX P1 Docs P2 Docs Learn Events
Why C is better than BASIC, can anyone provide live example? - Page 5 — Parallax Forums

Why C is better than BASIC, can anyone provide live example?

1235712

Comments

  • AribaAriba Posts: 2,690
    edited 2015-04-01 13:49
    Ray0665 wrote: »
    Examples

    #include <stdio.h>
    void main() { while (1) { printf("This is dumb.\n"); } }

    --OR--

    10 print "This is dumb"
    20 goto 10

    Which is better????

    I'm pretty sure that BASIC takes a bit longer to be dumb, so that is one point for BASIC:

    C: 1 - BASIC: 1

    BTW: My BASIC compiler was faster than Catalina C, so one point more for BASIC:

    C: 1 - BASIC: 2

    Andy
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 14:05
    Do we really want to go down the road of which programming language is better? If we nailed down this topic to a Windows operating environment, I could show you many examples of C programming that Basic probably couldn't even come close to attempting. Furthermore, at least 80% of all the applications that I have seen created in Basic, looked like they were put together by a child.

    Let's get serious.

    EDIT: Let's pit Microsoft's best C against Microsoft's best Basic
  • Heater.Heater. Posts: 21,230
    edited 2015-04-01 14:06
    POST
        QUOTE Mickster
            "I like the fact that BASIC has so many built-in functions and commands."" 
        ENDQUOTE
        REPLY
            PARAGRAPH
                SENTENCE
                    It is preferable to have as much as possible put into functions that are
                    external to the language syntax and semantics itself.
                ENDSENTENCE
                SENTENCE
                    This makes it possible swap out implementations so at better meet
                    your needs, say minimizing size, or including internationalization, etc. 
                ENDSENTENCE
                SENTENCE
                    Also, what your program does not use does not get linked in, that's great
                    when you want tiny code. 
                ENDSENTENCE
                SENTENCE
                    Tellingly the Python guys realized this and now their "print x" built in
                     is the "print (x)" function. 
                ENDSENTENCE
            ENDPARAGRAPH
        ENDREPLY
    
        QUOTE Mickster
            "Never did get the brevity-is-beautiful premise of the C language."
        ENDQUOTE
        REPLY
            PARAGRAPH
                SENTENCE
                    I feel that brevity is beautiful.
                ENDSENTENCE
                SENTENCE
                    Up to a point, C has it about right, APL over did it.
                ENDSENTENCE
                SENTENCE
                    I find all the redundant junk in source code like BASIC is annoying and ugly.
                ENDSENTENCE
                SENTENCE
                    It taxes ones brain cycles to filter it out.
                ENDSENTENCE
                SENTENCE
                    Perhaps that's why we punctuation and formatting in human languages
                    rather than keywords!
                ENDSENTENCE
            ENDPARAGRAPH
        ENDREPLY
    
    
        QUOTE jmg
            "Contrast that with C, where a whole string of } are the End closures for almost everything.."
        ENDQUOTE
        REPLY
            PARAGRAPH
                SENTENCE
                    IF you have a long string of } THEN
                        you are doing it wrong.
                    ENDIF
                ENDSENTENCE
            ENDPARAGRAPH
        ENDREPLY
    
        QUOTE jmg
            "You really DO need a smart Syntax highlighting Editor + style rules, to help you out of that morass."
        ENDQUOTE
        REPLY
            PARAGRAPH
                SENTENCE
                    A syntax highlighter is a luxury not an essential, a lot of the time I
                    don't bother with such things.  
                ENDSENTENCE
                SENTENCE
                    Source code, like poetry, should flow nicely and not need a syntax
                    highlighter to make it readable.  
                ENDSENTENCE
                SENTENCE
                   Style rules are always a good idea, especially in a language that supports GOTO :) 
                ENDSENTENCE
            ENDPARAGRAPH
        ENDREPLY
    
    
        QUOTE jmg
            "Source-code-Size has not been an issue for some decades,..." 
        ENDQUOTE
        REPLY
            PARAGRAPH
                SENTENCE
                   It is not about how many bytes it takes to store. Source code size is
                   an issue for the mind that has to read it.
                ENDSENTENCE
                SENTENCE
                   Filtering out all that redundant verbiage is unnecessary mental work.
                ENDSENTENCE
            ENDPARAGRAPH
        ENDREPLY
    ENDPOST
    
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 14:16
    LOL Thats funny
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-04-01 14:20
    idbruce wrote: »
    Let's pit Microsoft's best C against Microsoft's best Basic
    There's only one C. OK, maybe there's a few variations of C, but the differences are pretty minor. There seem to be lots of varieties of Basic. So maybe the proponents of Basic should fight it out to determine which one is the best one, and then we can compare it with C.
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 14:27
    There's only one C. OK, maybe there's a few variations of C, but the differences are pretty minor. There seem to be lots of varieties of Basic. So maybe the proponents of Basic should fight it out to determine which one is the best one, and then we can compare it with C.

    I was just trying to point out that we need a playing field with some highly competitive opponents. Visual Basic and Visual C++ seem to be worthy opponents :)
  • RsadeikaRsadeika Posts: 3,837
    edited 2015-04-01 14:36
    So maybe the proponents of Basic should fight it out to determine which one is the best one, and then we can compare it with C.
    To do what? For a comparison, I would nominate freeBasic, in fact I would like to see PropBasic become more like freeBasic.

    Ray
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 14:38
    For example, Charles Petzold, a well known book author of programming with C for Windows, once wrote a C program named "Scramble.exe". Let me see a Visual Basic program that can even come close to the C version.
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-04-01 14:38
    idbruce wrote: »
    I was just trying to point out that we need a playing field with some highly competitive opponents. Visual Basic and Visual C++ seem to be worthy opponents :)
    Yes, but you mentioned Microsoft, which is going cause a lot of the people on this forum to scurry away like rats from a sinking ship.
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 14:45
    And then, once again in a Windows environment, well known author Dino Esposito has shown many examples of scripting the Windows shell. I would really like to see some Visual Basic programming that could duplicate his work.
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 15:02
    Just one more viewpoint and then I will shut up.

    Comparing C against Basic on a microcontroller, is like watching two children fighting on the playground.

    Now if you put them against each other on a real computer, then we have a main attraction bout.

    DING DING
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-04-01 16:50
    "Real computer"??

    Now we can debate what is a "real computer"!

    Enterprise mainframe?

    Super mini-computer?

    Scalable guest on a cloud somewhere?

    Maybe an LPAR or VPAR carved out of some other mini?

    A PC? (Once we define that in the other thread)

    Just what is this "real computer" you write of?

    ...then we can put C in one corner against the languages real enterprise level business applications are written in and see how it does.


    Oh, the cans of worms you've just opened in search of the "best"! :D
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 17:17
    Oh, the cans of worms you've just opened in search of the "best"!

    You have made a very valid point :) I leave it to the rest for debate :)
  • MicksterMickster Posts: 2,693
    edited 2015-04-01 17:50
    So, Bruce,

    Is this where you finally answer the OP?

    I was certain that it was you who recently said on this very forum (paraphrasing) "what is K&R, I don't think I've ever heard of that"
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 18:10
    Mickster

    What is one reference, I have a bunch of references. I cannot know them all. If you think Charles Petzold, Dino Esposito, Jeff Prosise, David Kruglinski, George Shephard, Scott Wingo, and Ivor Horton are slouches, then you are sadly mistaken. What the heck do I need K&R for????
  • MicksterMickster Posts: 2,693
    edited 2015-04-01 18:15
    idbruce wrote: »
    Mickster
    What the heck do I need K&R for????

    LOL....kinda like a priest saying "what the heck do I need God for?"

    They are the creators of your beloved programming language.... Lol
  • 4x5n4x5n Posts: 745
    edited 2015-04-01 18:16
    tonyp12 wrote: »
    I'm warming up to C, it's like a pre-compiler for Asm and if you write the syntax correct it's pretty efficient and IAR have a setting for high that can be based on speed or code size.
    example, A function can be set for __inline and it will not actually call it but treat it as a macro if your settings is for speed.

    If you #include <stdbool.h> you get boolen support, but it does waste a whole byte for a 0 or 1.

    bitfield structure extension does handle bits as boolen just fine, add Union and you got yourself a nice GPIO register system.
    struct {
    char a:1;
    char b:1;
    char c:1;
    char d:1;
    char e:1;
    };

    I've always looked C as a high level assembler!!
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 18:23
    Mickster
    They are the creators of your beloved programming language.... Lol

    So what, I couldn't give a flying saucer who created it. All I know is that it will blow the pants off Basic.
  • ctwardellctwardell Posts: 1,716
    edited 2015-04-01 18:33
    Clearly neither the OP, Bruce nor Mickster know LISP or they would not be having this discussion.

    C.W.
  • David BetzDavid Betz Posts: 14,516
    edited 2015-04-01 18:35
    ctwardell wrote: »
    Clearly neither the OP, Bruce nor Mickster know LISP or they would not be having this discussion.

    C.W.
    Yes!! LISP! The only perfect programming language. Only problem is you wear out your paren keys quickly. :-)
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 18:40
    I once knew a lady that had a LISP :)
  • MicksterMickster Posts: 2,693
    edited 2015-04-01 18:44
    idbruce wrote: »
    Mickster
    All I know is that it will blow the pants off Basic.

    Cool, so here is your cue!
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 18:48
    Mickster

    You just keep antagonizing me.... Don't you ever get tired of being an .....

    And do you ever make a worthy contribution besides causing trouble?
  • MicksterMickster Posts: 2,693
    edited 2015-04-01 19:02
    idbruce wrote: »
    Mickster besides causing trouble?

    Do you see me using the Parallax forum to advertise my, well, vaporware skills?
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-04-01 19:13
    Now, now, kids! It's all fun and games until someone loses an I-- !!

    :D

    Let's attack the languages not each other!
  • MicksterMickster Posts: 2,693
    edited 2015-04-01 19:17
    mindrobots wrote: »
    Now, now, kids! It's all fun and games until someone loses an I-- !!

    :D

    Let's attack the languages not each other!

    I merely would like to see what was claimed in post #124
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-04-01 20:28
    @ Bruce

    re:once again in a Windows environment, well known author Dino Esposito has shown many examples of scripting the Windows shell. I would really like to see some Visual Basic programming that could duplicate his work.
    ====================================================================
    Windows Script Host Programmer's Reference Paperback – Dec 1999
    by Dino Esposito (Author)

    The Windows Script Host (WSH) is Microsoft's response to the need for a way of programming Windows in a manner analogous to the way batch files can be used to automate jobs in MS-DOS. Rather as Office 2000 provides VBA (Visual Basic for Applications) as a development tool, Windows 98 and Windows 2000 contain the Windows Script Host.

    WSH enables you to use scripting languages - VBScript and JScript are available by default - to access


    http://www.amazon.ca/Windows-Script-Host-Programmers-Reference/dp/1861002653
    ===================================================================================

    WSH was designed to work with VB scripting >>
    (copied & pasted from below)
    - WSH engines include various implementations for the REXX, BASIC, Perl, Ruby, Tcl, PHP, JavaScript, Delphi, Python, XSLT, and other languages.
    - Windows Script Host supports scripts that are written in Visual Basic Scripting Edition


    From Microsoft:

    Windows Script Host supports scripts that are written in Visual Basic Scripting Edition (VBScript) or JScript. When a script is started from the Windows desktop or from the command prompt, the script host reads and passes the contents of the specified script file to the registered script engine. The script engine uses file name extensions (.vbs for VBScript; .js for JScript) to identify the script instead of using the SCRIPT tag (used in HTML). Because of this, you do not have to be familiar with the exact programmatic identifier (ProgID) of the script engines. The script host itself maintains a mapping of script extensions to ProgIDs, and uses the Windows association model to start the appropriate engine for a given script.

    WSH engines include various implementations for the REXX, BASIC, Perl, Ruby, Tcl, PHP, JavaScript, Delphi, Python, XSLT, and other languages.

    ================================================================================
    Windows Script Host
    From Wikipedia, the free encyclopedia
    The icon for Windows Script Host

    The Microsoft Windows Script Host (WSH) is an automation technology for Microsoft Windows operating systems that provides scripting abilities comparable to batch files, but with a wider range of supported features. It was originally called Windows Scripting Host, but was renamed for the second release.

    It is language-independent in that it can make use of different Active Scripting language engines. By default, it interprets and runs plain-text JScript (.JS and .JSE files) and VBScript (.VBS and .VBE files).

    Users can install different scripting engines to enable them to script in other languages, for instance PerlScript. The language independent filename extension WSF can also be used. The advantage of the Windows Script File (.WSF) is that it allows the user to use a combination of scripting languages within a single file.

    WSH engines include various implementations for the REXX, BASIC, Perl, Ruby, Tcl, PHP, JavaScript, Delphi, Python, XSLT, and other languages.

    Windows Script Host is distributed and installed by default on Windows 98 and later versions of Windows. It is also installed if Internet Explorer 5 (or a later version) is installed. Beginning with Windows 2000, the Windows Script Host became available for use with user login scripts.

    http://en.wikipedia.org/wiki/Windows_Script_Host

    =================================================================================================================================================
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 20:29
    I thought I was very clear in Post #130. Perhaps I need to explain it to you
    For example, Charles Petzold, a well known book author of programming with C for Windows, once wrote a C program named "Scramble.exe". Let me see a Visual Basic program that can even come close to the C version.
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 20:32
    Come On Bob

    WSH isn't even in the same ballpark as C or full blown Basic.
  • idbruceidbruce Posts: 6,197
    edited 2015-04-01 20:37
    Hey Bob

    I unitentionally used the word scripting, because I know he was into that stuff. I was referring more to his stuff in "Visual C++ Windows Shell Programming". Some pretty in depth stuff.
Sign In or Register to comment.