I have been writing some CGI scripts in C++, and I was wondering if anyone else has done the same? I have built a pretty decent sized library of functions I use a lot for formatting form inputs and such. The reason I chose C++ is because I'm so familiar with it. I was wondering if I should do myself a favor and learn a language a little more popular for CGI scripting. From what I know so far, perl or bash scripts wouldn't be as portable and reusable as c++ code would be. What is everyone's opinion on using C++ vs other languages like Perl or PHP

I've done enough CGI with C and C++ to realize that they're very poor languages for it. Perl, or any language with powerful string handling capabilities, is much better suited to CGI.

Member Avatar for iamthwee

c++ has strong string handling capabilities.

>c++ has strong string handling capabilities.
Bwahahahaha!

Member Avatar for iamthwee

>Bwahahahaha!

What so funny _jsw? I thought c++ style strings had reasonably good string handling capabilities? :sad:
Or r u making a comparison of pearl's regex library?

>What so funny _jsw?
C++'s string handling capabilities are horrible. Not the worst, that's a spot reserved for C, but pretty low on the totem pole. Anyone who says that C++ is good at text manipulation clearly hasn't don't much of it. That's what's so funny. :)

Member Avatar for iamthwee

>What so funny _jsw?
C++'s string handling capabilities are horrible. Not the worst, that's a spot reserved for C, but pretty low on the totem pole. Anyone who says that C++ is good at text manipulation clearly hasn't don't much of it. That's what's so funny. :)

hmm, I admit the perl regex library out-do c++ style strings... but c++ style strings still support all these and lest we forget, there is nothing stopping you from using c++ with the boost library.

:cry:

>I admit the perl regex library out-do c++ style strings...
Regex isn't a library, it's built into the language.

>c++ style strings still support all these
Primitive operations that I would expect from any string type. That's not exactly an argument that C++ strings are powerful.

>there is nothing stopping you from using c++ with the boost library
Oh, then that means I can counter you with CPAN? :)

Member Avatar for iamthwee

>Regex isn't a library, it's built into the language.

That's what I meant. He he.

>Primitive operations that I would expect from any string type. That's not exactly an argument that C++ strings are powerful.

Hmm, but what separates perl from c++? The fact that the regex utilities are built in as opposed to the boost libraries in c++ that are not?


>Oh, then that means I can counter you with CPAN?
Yes you can. :lol:

Hmm, but what separates perl from c++? The fact that the regex utilities are built in as opposed to the boost libraries in c++ that are not?

It's quite simple. You can get a lot more done in Perl in a given amount of time than you can with C++. It's not worth the extra effort to use C++ because you don't get any considerable speed benefit. You'd be better off paying for a better server and using Perl than you would be using C++ on one cheap server, because bandwidth and perhaps database access time is the main limitation on the end-user's perception of speed.

#!/usr/bin/perl -ap
eval(("\$s[-2]$_=pop\@s",'push@s,$_')[!/^[-+*\/]$/])for@F;$_="$s[-1]\n"

Nothing beats having a one-line RPN calculator, too.

Member Avatar for iamthwee

Nothing beats having a one-line RPN calculator, too.

Wow. That was gud.

c++ has strong string handling capabilities.

Well as far as i know Python also has real good string handling capabilities and i guarantee far better than C or C++ since it is somewhat based on the concepts of PERL. (is it?)

Yes. Perl, Python, and Ruby all have good string handling abilities. Python's not really based on Perl, though.

Yes. Perl, Python, and Ruby all have good string handling abilities. Python's not really based on Perl, though.

Well talking about python as we all know that it has all the qualities that good prgg. lang. should have and is the amalgum of all the best features or the famous langs.

Python can be used for web prgg., as a scripting lang in games, also for development of games (Freedom force by Sierra) and in extensive mathematical intensive fields (used by NASA).

SO y does it not replace all the langs. existing and rule the world.
Why is C++ so powerful and famous when even Python can offer all the features and much more?

Well talking about python as we all know that it has all the qualities that good prgg. lang. should have and is the amalgum of all the best features or the famous langs.

This is just untrue. Python does not have macros the way Lisp and Scheme have macros, and it does not have lazy evaluation. No good support for anonymous closures.

Why doesn't (lambda x: print x) work?

SO y does it not replace all the langs. existing and rule the world.
Why is C++ so powerful and famous when even Python can offer all the features and much more?

Why is Python the ideal when there are other, 'better' languages out there? Why not Lisp? Why not Haskell?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.