Solved

4 things C can do that Pascal canot

Posted on 1998-09-25
10
254 Views
Last Modified: 2010-04-15
Name 4 things that can be done in C that cannot be done (easily) in Pascal.
0
Comment
Question by:morgan1
10 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1253047
Which Pascal ?

Turbo Pascal / Delphi - have a lot of language extensions to support C/C++ concepts
0
 
LVL 2

Accepted Solution

by:
JYoungman earned 200 total points
ID: 1253048
1 longjmp().
2 Pass arbitrary-length arrays to a subroutine.
3 Change the buffering mode of stdin/out
4 Handle signals
5 Separate compilation (this is only a criticism of old or          standard-conforming implementations).


0
 

Author Comment

by:morgan1
ID: 1253049
What is meant by handle signals?
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 11

Expert Comment

by:alexo
ID: 1253050
#1, #3 and #4 are not the C language per se but the standard library.

* Due to the calling convention used by Pascal, it cannot pass a variable number of arguments to a function (e.g., printf).

* Casting (especially pointer types).
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1253051
alexo,
* pascal can pass variable number of arguments: writeln()
  (but it's limited to pascal-known functions)
* casting cannot be done, but you may use variant records
  (which results in the same as casting)

What cannot be done in pascal:
  - getting addresses (C's  &  operator)
  - pointer to functions
  - operators:  ++  --  [=-/*]=
  - variable definition/declaration in blocks
  - declaring arrays of undefined length



0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1253052
In Delphi/Turbo you can do quite a lot of the supposedly impossible things listed previously.

But Of course that's not "standard" Pascal

0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1253053
In Delphi and Turbo Pascal, you can create a function that accepts a variable number of parameters of varying types.  In Delphi you would declare a function with one formal parameter, like this:

procedure x (const y :array of const)

and use the VType field of TVarRec to check each variable's type.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1253054
Alexo:

  "- getting addresses (C's  &  operator)
  - pointer to functions  "

  Is the @ operator available in ANSI Pascal, or is it a Turbo Pascal specific operator?


0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1253055
In Delphi and Turbo Pascal, you can create a function that accepts a variable number of parameters of varying types.  In Delphi you would declare a function with one formal parameter, like this:

procedure x (const y :array of const)

and use the VType field of TVarRec to check each variable's type.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1253056
Please excuse me for posting twice, it was an accident
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which checksum is this? 7 144
Read file descriptor 3 in C 14 107
Why does module make constant click noise ? 9 130
TCP/IP Socket - connection close results in data lost 14 134
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question