Solved

4 things C can do that Pascal canot

Posted on 1998-09-25
10
252 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
logging Access violation 6 18
pgpool-II on Ubuntu 14.04... ARGH! 5 811
Problem to save 10 122
Raspberry Pi 3 to send text message 7 16
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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now