Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

4 things C can do that Pascal canot

Posted on 1998-09-25
10
Medium Priority
?
261 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 600 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
Suggested Courses

971 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