Solved

4 things C can do that Pascal canot

Posted on 1998-09-25
10
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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

Independent Software Vendors: 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!

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…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

717 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