delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/12/03:37:49

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT DELORIE DOT COM
Date: Wed, 12 Jun 1996 08:25:26 GMT
Subject: The 2000-line program and funny gcc moan re macro `clear'
Message-ID: <2B47CCC5025@fs2.mt.umist.ac.uk>

  boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au (Gregary J Boyles) wrote:-
> What does this crap mean???
> I'm not making calls to clear!
> 
> In file included from /usr/local/lib/g++-include/iostream.h:31,
>                  from stringc.hpp:10,
>                  from field.cpp:5:
> /usr/local/lib/g++-include/streambuf.h:207: arguments given to macro `clear'
> In file included from stringc.hpp:10,
>                  from field.cpp:5:
> /usr/local/lib/g++-include/iostream.h:169: arguments given to macro `clear'
> /usr/local/lib/g++-include/iostream.h:172: arguments given to macro `clear'

(1) I tried to compile this program myself (with v1) and got this:-
t$_.cc:126: curses.h: file not found
t$_.cc:129: string.hpp: file not found
t$_.cc:130: display.hpp: file not found
t$_.cc:131: keycodes.hpp: file not found
t$_.cc:561: curses.h: file not found
t$_.cc:658: string.hpp: file not found

  As one line of this printout says, CURSES!!!
  My gcc hasn't got these .h files! Are they a v2 innovation?

> See files included below - sorry I can't remove irrelevant code
> because I haven't clue what all this means or what might be causing it.

  Does his program have to be so sprawly!? for someone having wade through it.
  (0) E.g. these 13 lines are to me just as clear compacted to 4 lines thus:-
    if ((Converter.Long<-32768) || (Converter.Long>32767))
    {
      Result=false;
      Integer=0;
    }
    else
    {
      Result=true;
      Integer=Converter.Int;
    }
  }
  return Result;
}
  ............................................
    if ((Converter.Long<-32768) || (Converter.Long>32767)) {
      Result=false; Integer=0; }
    else { Result=true; Integer=Converter.Int; } }
  return Result; }

  (2) To separate functions, it is clearer to me to put a `/*-----*/' line
between, than e.g. 4 blank lines.
  (3) I see no reason not to put short functions all on one line, e.g.:-

/* The constructors */
PositionC::PositionC() { X=0; Y=0; }
PositionC::PositionC(const int X_,const int Y_) { X=X_; Y=Y_; }
PositionC::~PositionC() { X=0; Y=0; } /* The destructor. */

/* Functions for setting and getting data members. */
void PositionC::SetPosition(const int X_,const int Y_) { X=X_; Y=Y_; }
int PositionC::GetX() { return X; }
int PositionC::GetY() { return Y; }

  The above 9 lines were 52 lines in the original!

- Raw text -


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