Results 1 to 10 of 84

Thread: C/C++ vs Pascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    C/C++ vs Pascal

    Any FPC guys to back this up?
    There is a big difference between FPC and Delphi in one aspect.
    Free Pascal allows you to perform arithmetic operations with pointers.
    Code:
    var
      p: pointer;
      a, b: integer;
    ...
    p:=p + (a*b);
    In Delphi you must add a lot of unnecessary typecasts:
    Code:
    p:=pointer(cardinal(p) + (a*b));
    Which is stupid IMO, because the pointers in themselves are a way around the strong typing.

  2. #2
    Quote Originally Posted by Chebmaster View Post
    There is a big difference between FPC and Delphi in one aspect.
    Free Pascal allows you to perform arithmetic operations with pointers.
    Code:
    var
      p: pointer;
      a, b: integer;
    ...
    p:=p + (a*b);
    In Delphi you must add a lot of unnecessary typecasts:
    Code:
    p:=pointer(cardinal(p) + (a*b));
    Which is stupid IMO, because the pointers in themselves are a way around the strong typing.
    this is incorrect, since delphi 2009 there is a directive to allow pointer maths......

    Code:
    {$POINTERMATH ON}
    since i use it all the time....

  3. #3
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    I totally agree with chronozphere, Learning lots of languages is the way to go, it does indeed, without a doubt make you a better programmer.

    But OOP is my favourite language and it will always be.

    From a pure project perspective, if I have a task to complete that requires a native language I can always complete the job faster in OOP. And that's not because it's my strongest language, if anything my strongest language is C++ but when dealing with a large complex system, the OOP style leads to far less bugs which on any sizable project will always be the dominating factor, no matter how good you are.

    Of course, if your project is on Windows and doesn't require blistering performance? .NET offers faster development times than both (although not strictly because of garbage collection! believe me, on a large, memory hungry project? it *will* become more trouble than it's worth)

    But Native Code? can't beat OOP for time to market, Borland knew this, Embarcadero knows this.

    And picking up development on existing project? (other than .NET) OOP wins again, I'd of moved on to the next class in OOP while I'd still be studying the previous one in C++

    if it was a subject I knew as well as a C++ competitor? I'd always win in an implementation race.
    Last edited by phibermon; 22-09-2011 at 08:09 PM.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

  4. #4
    Quote Originally Posted by Colin View Post
    this is incorrect, since delphi 2009 there is a directive to allow pointer maths......

    Code:
    {$POINTERMATH ON}
    since i use it all the time....
    guys the thread is so old no wonder why since delphi 2009 there are some more stuff

    the reason why in theory there are more C++ developer is that it was free from beginning and there was alot of free compilers out there
    today its just so that cause of this early matter that most studios use C++ (cause its not only game developer but also engine developer)
    newer engines btw. support C++ style language but dont use C++ as common solution (see lua, unreal script etc.)

    fun fact is as far as i now there few developers who develope there tool chain in Object Pascal or C#

  5. #5
    that may be true, but pascal is by no way a bad choice, there is no performance loss by using delphi vs c++, they both are relatively the same nowadays, but the benifit of delphi is the readability, you could say pascal resembles more assembly than c++ could ever.... readable words are always much easier for the human brain than symbols, i know many people will now argue the toss that c++ is more readable and so on, but that is just because it is their favorite language (which of course is fine - but it still is besides the point)

    and yes i know this thread is old, but people still come across this thread and read it so its best for potential new delphi developers not to get the wrong idea.
    Last edited by Colin; 23-09-2011 at 08:41 AM.

  6. #6
    Quote Originally Posted by Colin View Post
    readable words are always much easier for the human brain than symbols, i know many people will now argue the toss that c++ is more readable and so on, but that is just because it is their favorite language (which of course is fine - but it still is besides the point)
    thats on of the reasons why I use pascal :>
    its fun to code in pascal and easy to understand for me, i still learned a bit of C++ but i really dont like it, i dont like to use pointers and often get confused by these symbolic language when it comes to complex problems (or sometimes even easy ones x) )

  7. #7
    Why are you still debating Pascal vs C/C++? Why not English vs French?

    For beginners, the language itself does not matter as long as it can be represented in a fairy readable way and it mostly depends on who is teaching this subject.

    In professional sphere, as long as you took enough software engineering courses, the language also does not matter because it's just a low-level way of representing your final application's architecture. You'll be spending time doing other things anyway, such as designing UML diagrams, etc. Converting the properly-written diagrams to code is mostly a trivial task and there are IDEs that do this for you.

    In any case, a proficient developer will use almost any programming language as a powerful tool. Well, the only exception is probably Lotus Notes Script.

    The only thing that makes the difference is the compiler itself and the development IDE. The first can make your application execute faster (though in many cases these days raw execution speed is no longer an issue) and the second saves time when writing and/or modifying code.

    I think latest versions of Visual Studio and Delphi XE 2 work very well in terms of compiler, and they have excellent IDEs. Even for PHP, there are some excellent IDEs, like Nusphere's PhpEd.

    For beginners I think C#, Delphi's Pascal and PHP are all excellent candidates to start with.

  8. #8
    @LifePower: I completely agree with what you are saying. Learning a new language is mostly about the syntax, while most of the semantics are shared between different languages, making it easier to learn a whole bunch of them.

    But OOP is my favourite language and it will always be.
    OOP is not a language. It's a paradigm. The paradigm is "used" in different language. JAVA is entirely based on OOP, but Pascal/C++ are so called multi-paradigm languages, supporting both the "procedural programming paradigm" and the "object oriented programming paradigm".
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •