delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/01/13:29:12

Date: Wed, 1 Jun 1994 10:57:15 -0600
From: tesla AT lamar DOT ColoState DOT EDU (Jon Nash)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Possible bug in Complex class (?)

Hello all,

I'm writing a program that uses the function double arg(Complex) that is in
the Complex C++ include file.  I found that I needed to modify the results of
arg() so I began to code a function to do that... starting by just returning
arg(z).  The code crashes.  I've stripped down the code...  Do you all see
any reason for the code to crash, does it crash on your system?

(I'm using v1.11maint5)  The code compiles and runs fine with TC.

<-------------  Begin Cut  --------------------->
//
//  This program crashes...  running symify on it yields _main+122
//
//    Compile with gcc test.cc -o test -lgpp -lm

#include <iostream.h>
#include <math.h>
#include <Complex.h>

double a(Complex z);

int main(void)
{
  Complex z;

  z=Complex(1,2);
  cout << arg(z) << "\n";
  cout << "-------\n";
  cout << a(z) << "\n";
  return 1;
}

double a(Complex z) {
  return arg(z);
}

<-------------  End Cut  ----------------------->

Thanks for any help you can provide! :)

Jon Nash
Physics Department
Colorado State University
Tesla AT Lamar DOT ColoState DOT EDU

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019