batch crossing-over python, C or C++ ?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

batch crossing-over python, C or C++ ?

#1 Post by Ed Dyreen » 01 Nov 2012 16:21

'
When things get tooComplex in batch, I want to call upon other programs.

But what language to write those programs in, Python, C, C++ ?
Some say I should learn all three, in that order.

Python: ( As a java dev I find Python syntax ugly and confusing. )

Code: Select all

def foo(x):
    if x == 0:
        bar()
        baz()
    else:
        qux(x)
        foo(x - 1)
C:

Code: Select all

void foo ( int x ) {
    if ( x == 0 ) {
        bar();
        baz();
    } else {
        qux( x );
        foo( x - 1 );
    }
}
I will typically write very small independent programs to use with my batch scripts.
So only require a text-based interface, maybe a little QBASIC like drawing of shapes and menus.
Then the ++ in C confuses me, do I need to download C, C++, both ?
Thanks " :) "

Aacini
Expert
Posts: 1932
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: batch crossing-over python, C or C++ ?

#2 Post by Aacini » 01 Nov 2012 16:36

Hi, Ed!

I think you already know my answer: I prefer assembly language for several reasons.

First, the independent programs are very small as you said. If a program is relatively large, DON'T use assembler!

Second, Batch file processing is inherently slow. Any external program that will be called from a Batch file SHOULD BE as faster as possible.

And last (but not least), I like it! :D

Don't think about this matter anymore! Start to learn assembly language right now :!:

Antonio

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: batch crossing-over python, C or C++ ?

#3 Post by Ed Dyreen » 01 Nov 2012 17:09

'
Hmm, Good tutorials for x86 are not easy to find, where do I start ?

Never understood why school tought us programming an extinct RISC-processor.
Maybe cause of the (R)educed factor.

I liked it aLot though.

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: batch crossing-over python, C or C++ ?

#4 Post by Liviu » 01 Nov 2012 17:49

Ed Dyreen wrote:I will typically write very small independent programs to use with my batch scripts.
So only require a text-based interface, maybe a little QBASIC like drawing of shapes and menus.

"Independent" as in machine-independent, runnable on any platform (Linux has scripts, too)? Then Python. Or, "independent" as in standalone, requiring no installation, libraries, or "sandbox" runtime? Then C or C++.

Note however that you set the bar pretty high to begin with. None of your choices is an easy language to master. Python might be the quickest to get immediate results, and far more forgiving of mistakes. C or C++ are closest to the bare metal, and allow you to do anything the OS allows, like shooting yourself in the foot with incredible efficiency ;-)

Just a thought, but have you considered natively hosted scripting languages, like JScript or VBScript?

Ed Dyreen wrote:Then the ++ in C confuses me, do I need to download C, C++, both ?

C and C++ are different languages, but most compilers come in a C/C++ combo that can compile either.

Ed Dyreen wrote:Good tutorials for x86 are not easy to find, where do I start ?

Don't. The world is moving to 64-bit. x86 is usually used to mean the 32-bit Intel architecture.

Liviu

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: batch crossing-over python, C or C++ ?

#5 Post by Ed Dyreen » 01 Nov 2012 19:54

Liviu wrote:"Independent" as in machine-independent, runnable on any platform (Linux has scripts, too)? Then Python. Or, "independent" as in standalone, requiring no installation, libraries, or "sandbox" runtime? Then C or C++.
Sorry, that was poorly formulated, as in standAlone.
Liviu wrote:Just a thought, but have you considered natively hosted scripting languages, like JScript or VBScript?
I know vbScript, jScript, AutoIt, all powerfull enough to replace all batch I ever wrote !
But want to provide batch functions and only escape if absolutely necesarry.
I have a small library of vbScript files, but don't like vbScript. And AutoIT is slow to initialize.
I'm actually writing an au3 library as well, adding some OO-Design to it, sound familiar ? LoL...
Liviu wrote:Don't. The world is moving to 64-bit. x86 is usually used to mean the 32-bit Intel architecture.
I've seen Aacini's witchCraft before, how many years of assembly language programming experience do you have Liviu ?
Isn't the instruction set like the same ?

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: batch crossing-over python, C or C++ ?

#6 Post by Liviu » 01 Nov 2012 23:43

Ed Dyreen wrote:I know vbScript, jScript, AutoIt, all powerfull enough to replace all batch I ever wrote !
But want to provide batch functions and only escape if absolutely necesarry.
I have a small library of vbScript files, but don't like vbScript. And AutoIT is slow to initialize.

Notice that you left out jScript. That might be worth a second look given your java background, even if the other "j" is not quite the same.

Ed Dyreen wrote:I've seen Aacini's witchCraft before, how many years of assembly language programming experience do you have Liviu ?

Some, but that's immaterial. Assembly is not my language of choice. Carefully written C code compiled with a decent compiler can match assembler performance most of the time. Yes, there will always be that 0.1% corner case where one can write a benchmark to expose a certain shortsight in some compiler. If yours falls in that category, then go for assembly. Otherwise, maybe think twice.

Ed Dyreen wrote:Isn't the instruction set like the same ?

Not quite. I'd start from http://software.intel.com/en-us/articles/introduction-to-x64-assembly and follow the links.

Liviu

Post Reply