A r t i c l e s

Note: This Wiki is
outdated, personal views
may have changed.
L505 A.I. bot is dead
long live THX 1138

M a i n P a g e

D i r e c t o r y

Pascal Less Verbose Than C

Let's get one thing straight. C is not always terse.

The word terse means "short and to the point". C is not always terse. There is a difference between being obfuscated and being terse. Perl is sometimes terse and obfuscated. Pascal is readable, sometimes terse and sometimes too verbose. Being terse and readable is a good thing. Being terse and unreadable is a bad thing. Being verbose and unreadable is an extremely bad thing. C is unreadable and verbose many times! Look at the example below.

An age old example of using pointers in Pascal vs C. Which one is more verbose now?

The code in Pascal looks like this:

 program test;  

   myint: ^integer;  

   myint^:= 10;    
The code in C looks like this:
 void main()  


      int *myint; 
      myint = (int *) malloc (sizeof(int));    
      *myint = 10;    


Both programs are 9 lines (not including whitespace). However, the actual code on each line is bizarre and verbose looking in the C example.

In the Pascal example, it is to the point and short. In the C example, it is verbose and obfuscated at the same time.

It is reasonable to be terse and readable. Normally one would consider being terse with being obfuscated. But this is not the case in C. In C, you happen to walk into many situations that are obfuscated and verbose - which means shooting yourself in the foot twice before you knew it.

And for all those programmers out there who think pascal is still too verbose...

Here is the example in Qompute Language:

 prog test;  

   i: ^int;  

   i^ = 10;    

Now let's look at another example:

In Pascal, the code looks like this:

 program samp;  


   rec = record      
     i: integer;      
     f: real;      
     c: char;    

   p: ^rec;  

   p^.i:= 10;    
   p^.f:= 3.14;    
   p^.c:= 'a';   
   writeln(p^.i, p^.f, p^.c);    
In C, the code looks like this:


 struct rec 

     int i; 
     float f; 
     char c; 

 void main() 

     struct rec *p; 
     p = (struct rec *) malloc (sizeof(struct rec)); 
     (*p).i = 10; 
     (*p).f = 3.14; 
     (*p).c = 'a'; 
     printf("%d %f %c\n", (*p).i, (*p).f, (*p).c); 

Both programs are 17 lines long. But the C code block is verbose and obfuscated, while the pascal code block is to the point, obvious, and short.
In many cases, C is not terse - it is just obfuscated. Remember that terse is not the same as obfuscated.
Big note: I do not advocate Standard Pascal. I'm talking about modern Pascal which is completely different than standard Pascal. Modern Pascal maybe shouldn't even be called Pascal because it is more like Modula 2/delphi/oberon. Names are only names.

Note: This Wiki is outdated, personal views may have changed.

This wiki contains info on life, health, humans, nature, programming, database, fads, paradigms, poems, principles, theories.

Articles may contain statements which some may find helpful and encouraging, or even discouraging.

Beware, I believe in the Grand Justice system.
_ _ _