Results 1 to 13 of 13

Thread: Are C and Pascal really that different?

  1. #1

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Are C and Pascal really that different?

    I'm learning Pascal at college and decided that it would be interesting to see how much like Pascal I could get C to look like. Well....
    Code:
    #include "pascal.h"
    
    program
    begin
    	STRING text[81];
    	
    	writeln ("Hello how are you?");
    	writeln ("Enter you name:");
    
    	readln (text);
    
    	write ("Hello ");
    	writeln (text);
    
    	finish
    end
    Easy with a the help of a few #defines and function declarations from pascal.h:
    Code:
    #define program int main (void)
    #define begin {
    #define end }
    #define finish return 0;
    
    typedef char STRING;
    
    extern void writeln (const char * str);
    extern void readln (char * str);
    extern char read (void);
    extern void write (const char * str);
    And here are the functions: (in a separate source file of course)
    Code:
    #include <stdio.h>
    
    void writeln (const char * str)
    {
    	puts (str);
    }
    
    void readln (char * str)
    {
    	gets (str);
    }
    
    void write (const char * str)
    {
    	printf (str);
    }
    
    char read (void)
    {
    	return getchar ();
    }
    So what do you think? Can anyone make it look a little more convincing?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Pascal sucks and so does C

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Spetnik
    C is a very powerful language. To say it sucks shows that you do not know much about it.
    Spetnik also sucks and can't take a joke

  4. #4
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Originally posted by Spetnik
    Well, based on some of the posts I've read here, you never know.
    Now that's no joke

  5. #5

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    No way does C suck. C is in my opinion one of the best programming languages out there. I'm not saying that makes it easy - I'm still learning it now.

    You have phenomenal power over your program and can even use C to create new programming languages. PHP for example and Perl are both written in C. I'm sure too that large parts of the VB compiler are written in C or C++ and probably most of the Windows shell.

    I may agreee on Pascal though. It seems a very strange programming language and I am not sure who uses it and why.

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I don't think that Pascal is used that much anymore. Unless there is apps that are written in Pascal that needs some fixing. That happends all the time.

    Some applications are still written in C but C++ are taking over more and more. Like all the apps in Office are now more or less just written in C++, the same things with games....


    ØØ

  7. #7
    Fanatic Member VisionIT's Avatar
    Join Date
    Nov 2002
    Location
    Workin'...
    Posts
    718
    Are C and Pascal really that different?
    Yes... C has its uses!

    To say it sucks is just odd! It may be difficult for some people to understand... but it's incredibly powerful.

  8. #8
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Pascal is not much used as a programming language but its still being used to teach beginners about programming becuase of its simplicity and highly structural approcah towards programming.

  9. #9
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Originally posted by visualAd
    You have phenomenal power over your program and can even use C to create new programming languages. PHP for example and Perl are both written in C. I'm sure too that large parts of the VB compiler are written in C or C++
    I'd say the lexical analysis and syntax checking are in C to aide the speed of development, and the compilers and interpreters are in assembly for speed...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  10. #10
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by plenderj
    I'd say the lexical analysis and syntax checking are in C to aide the speed of development, and the compilers and interpreters are in assembly for speed...

  11. #11
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Pascal developers have more or less just moved to Delphi. I never learned raw Pascal but I must say, Delphi is pretty awesome.

  12. #12

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    What does Delphi do?

  13. #13
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    It helps you make aps....

Posting Permissions

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



Click Here to Expand Forum to Full Width