🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

7 total messages Started by srwmrbd@windy.ds Wed, 01 Feb 1989 16:01
Zortech bugs
#2491
Author: srwmrbd@windy.ds
Date: Wed, 01 Feb 1989 16:01
130 lines
2742 bytes
This is a list of examples of things we have found that don't work in
Zortech C++ (1.07) but do work in Advantage/Designer C++  1.2 (beta-2)
on a PC.


Automatic conversions (p174-5) - Compiler returns a bug message (11157) when
   a conversion is required if the conversion is explicitly requested, a
   syntax error if it is not.


#include <stream.hpp>

class APPLES
{
   int napples;
public:
   APPLES() { }
   APPLES(int n) { napples=n; }
   operator int() { return napples; }
};

class ORANGES
{
   int noranges;
public:
   ORANGES(int n) { noranges=n; }
   operator APPLES() { return APPLES(2*noranges); }
};

main()
{
   APPLES a; ORANGES o=7;
   a=(APPLES)o;                        // bug 11157 generated by this line
//   a=o;                              // syntax error generated by this line
   cout << (int)a;
}


A further conversion(?) problem:


#include <stream.hpp>

class A
{
   int data;
public:
   A(int i) { data=i; }
   friend ostream& operator<<( ostream&, A& );
   operator int() { return (int)data; }
};

ostream& operator<<(ostream& o, A& a) { o<<a.data; return o; }

main()
{
   A aa(2);
   cout << aa;                  // this line returns a syntax error
}


A further conversion(?) problem:


#include <stream.hpp>

class V
{
public:
   V(char *);
   friend ostream& operator<<(ostream&, V&);
};

class M : public V
{
public:
   M(char *);
   friend ostream& operator<<(ostream&, M&);
};

main()
{
   cout << "test";                       // syntax error on this line
}




A variety of errors when an 8087 is used with float. There is no problem
if one replaces float by double or disables the 8087.


#include <stream.hpp>

float square(float x)  { return x*x; }

main()
{
   extern int _8087;
   if (_8087) _control87(0x300,0x300);
   cout << "8087 code = " << _8087 << "\n";
//   _8087 = 0;
   float x0=0.00000000000000000000000000000000000001;
   cout << x0 <<" "<< x0*x0 <<" "<< square(x0) <<"\n";
   float x1=0.0000000000000000001;
   cout << x1 <<" "<< x1*x1 <<" "<< square(x1) <<"\n";
   float x2=0.0;
   cout << x2 <<" "<< x2*x2 <<" "<< square(x2) <<"\n";
   float x3=0.00001;
   cout << x3 <<" "<< x3*x3 <<" "<< square(x3) <<"\n";
}


Help file problem

I have all the Zortech files on drive D but carry out development on
drive C. I am unable to access online help from drive C.



Notes: Zortech C++ compiles about 3 times faster than Glockenspiel + MSC 5.1
on my test program and will also handle bigger projects. Speed and codefile
size seem similar if you use the -f flag for Zortech. So, at least at the
development stage of a project on a PC, it is much nicer to use Zortech than
Glockenspiel but it is also frustrating not knowing whether an error is one's
own or Zortech's.


Robert Davies
Re: Zortech bugs
#2506
Author: rchen@m.cs.uiuc.
Date: Sun, 05 Feb 1989 20:43
7 lines
180 bytes

Zortech C++ didn't handle duplicate const declarations as well, so I
cann't put "const int a = 1;" in the header file.  Otherwise, Zortech
C++ is fine with me so far.

-Ron Chen
Re: Zortech bugs
#2514
Author: maxsmith@athena.
Date: Tue, 07 Feb 1989 18:46
6 lines
79 bytes

Use:
static const int i = 10;

Linkage is currently different that cfront.
Re: Zortech bugs
#2517
Author: tony@banana.cs.u
Date: Wed, 08 Feb 1989 12:39
29 lines
1026 bytes
In article <4800049@m.cs.uiuc.edu> rchen@m.cs.uiuc.edu writes:
>
>Zortech C++ didn't handle duplicate const declarations as well, so I
>cann't put "const int a = 1;" in the header file.  Otherwise, Zortech
>C++ is fine with me so far.
>
>-Ron Chen

I have a similar problem ...  Zortech won't link multiple object files
created from a header containing a class with static variables.

My guess is that each time you #include the class declaration it's static
variables are defined as local to the object file.  When they get linked
every object file which uses the class thinks it has the original static
variables rather than an extern reference.  Deciding which object file
should contain the real variables sounds like a juicy problem (or a new
version of the linker).

Not being able to have such a class in a header file rather defeats the
purpose of having the class declaration.

Any suggestions or hopes Walter Bright ?

How do Unix implementation get around this ?

	Tony O'Hagan

P.S.  I'm using ZTC Version 1.04
Re: Zortech bugs
#2519
Author: bright@Data-IO.C
Date: Wed, 08 Feb 1989 18:04
9 lines
341 bytes
In article <4800049@m.cs.uiuc.edu> rchen@m.cs.uiuc.edu writes:
<Zortech C++ didn't handle duplicate const declarations as well, so I
<cann't put "const int a = 1;" in the header file.

As a workaround, you can call it:
	static const int a = 1;
The problem is a is made global by default, not static. This will be
fixed in the next version.
Re: Zortech bugs
#2534
Author: bright@Data-IO.C
Date: Fri, 10 Feb 1989 21:09
19 lines
546 bytes
In article <2285@uqcspe.cs.uq.oz> tonyo@qitfit.qitcs.oz (Tony O'Hagan) writes:
>I have a similar problem ...  Zortech won't link multiple object files
>created from a header containing a class with static variables.

Declaring the class:
	class abc
	{	static int def = 3;
	};
Will cause multiple definitions (because common blocks cannot have
initializers).
It should be declared as:
	class abc
	{	static int def;
	};
and then in ONE of the modules:
	int abc::def = 3;
However, the int abc::def=3; is not implemented yet, but I will do it
soon.
Re: Zortech bugs
#2557
Author: cszohagan@qut.ed
Date: Tue, 14 Feb 1989 13:11
22 lines
784 bytes
In my attempts (as yet uncomplete) to tie in the back end of streams i/o
into a <curses.h> type window, I came accross a bug in Zortech's definition
of <stream.hpp>.  The 2nd constructor for streambuf is missing an initialisation
for the variable "FILE* fp".  This causes problems in the sputc() function
below if performing i/o on a buffer (as opposed to a file pointer).

Useful info if you ever get stuck fiddling with the back end of stream i/o
is that doallocate() allocates 1k chunks of memory and sets the alloc flag to 1.

include/stream.hpp
------------------

< streambuf(char* buf, int buflen) { setbuf(buf,buflen); alloc = 0; }

> streambuf(char* buf, int buflen) {
>	setbuf(buf,buflen); alloc = 0;
>	fp = (FILE *) 0;
> }

	Thanks Walter, I'm enjoying C++,
	Tony O'Hagan
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads