Re: Checking class dependencies.

vbdis@aol.com (VBDis)
14 Mar 2003 11:54:07 -0500

          From comp.compilers

Related articles
Checking class dependencies. nordgren.tommy@telia.com (Tommy Nordgren) (2003-03-09)
Re: Checking class dependencies. vbdis@aol.com (2003-03-14)
| List of all articles for this month |

From: vbdis@aol.com (VBDis)
Newsgroups: comp.compilers
Date: 14 Mar 2003 11:54:07 -0500
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
References: 03-03-036
Keywords: Java, types
Posted-Date: 14 Mar 2003 11:54:07 EST

Tommy Nordgren <nordgren.tommy@telia.com> schreibt:


>1. Check that the class inheritance graf contains no cycles.
>2. Check that the class inheritance graph contains no missing classes.
>3. Check - preferably in constant time - wether a class a is derived from a
>class b.


Have a look at Delphi or OPL (Object Pascal Language), which leaves no room for
such problems.


>4. Check wether a method is more specialized than another method with the
>same name.
>5. Check wether a method is less specialized than another method with the
>same name.
>6. Sort the set of methods with the same name:


Looks to me like sorting by the classes (inheritance) of the methods.


>7. My language will compile to C++ and a binary initialisation file.


If you forget about header files, and possibly about multiple
inheritance, then the inheritance is quite easily determined: Every
class can inherit only from classes which have been declared
before. This way you get an inheritance tree, and never an inheritance
graph with loops. The position (depth) of a class in that tree can be
used as the sorting criterium.


In Pascal and similar (Wirth) languages the declarations are strictly
related to the implementations, both together form one module (or
unit). Every unit can refer to (import from) other units, and
recursive definitions can be eliminated by disallowing circular import
references between the units. This idea stands in contrast to the
separation into unrelated header files (declarations) and modules
(implementations) in C/C++.


> How can I convert the storage format IEEE double (Macintosh byte
>order) to Windows and Linux doubles.


Reverse the byte order ;-) I don't see your problem with this task. If
you like pointers, then set one pointer to the begin of the source and
one to the end of the target field. Then move the bytes from source to
target in a loop, incrementing the source pointer and decrementing the
target pointer. Or use two arrays and copy from src[i] to
dst[n-i]. Many modern processors have means (flags or instructions)
for byte order conversion.


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.