delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/30/15:36:34

From: rpolzer AT web DOT de (Rudolf Polzer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Windows ME and DJGPP
References: <3A6CB71F DOT 8B4E86C9 AT phekda DOT freeserve DOT co DOT uk> <94k3dc$lf9$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <slrn96u191 DOT 2cl DOT rpolzer AT rebounce DOT rpolzer-lx> <94pm3k$1qf$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <slrn970p9v DOT 28f DOT rpolzer AT rebounce DOT rpolzer-lx> <94rrk4$sro$1 AT antares DOT lu DOT erisoft DOT se> <slrn973r3m DOT 1vo DOT rpolzer AT rebounce DOT rpolzer-lx> <9003-Sat27Jan2001104054+0200-eliz AT is DOT elta DOT co DOT il> <slrn9758nt DOT kg DOT rpolzer AT rebounce DOT rpolzer-lx> <qui57ts29nkob9g12f7rc2pual2hn501c6 AT 4ax DOT com> <slrn978aq2 DOT 11k DOT rpolzer AT rebounce DOT rpolzer-lx> <fsd97t4r1gesii5ke7u4vabee0hr8fl9mt AT 4ax DOT com>
X-newsgroup: comp.os.msdos.djgpp
X-Mailer: GehtDichNenScheissdreckAn 1.0
User-Agent: GehtDichNenScheissdreckAn 1.0
Message-ID: <slrn97bc57.4d2.rpolzer@rebounce.rpolzer-lx>
User-Agent: slrn/0.9.6.2 (Linux)
Date: Mon, 29 Jan 2001 19:04:24 +0100
Lines: 81
NNTP-Posting-Host: 213.6.55.205
X-Trace: 980886570 news.freenet.de 128 213.6.55.205
X-Complaints-To: abuse AT freenet DOT de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk> schrieb Folgendes:
> 
> > > It compiles cleanly like this:
> > > 
> > > int main(void)
> > > {
> > >  char *p = 0;
> > >  *p = 'X';
> > >  
> > >  return 0;
> > > }
> 
> > > > And I do not think clean code can contain a line which can produce many
> > > > errors that result in SIGSEGV but gives no hint about it.
> > > 
> > > Try stepping up the warnings you have enabled.  I don't think it's
> > > possible for gcc to flag bugs like in the above example but it might
> > > show up some other problem with your code.
> > 
> > Perhaps it can flag this one when optimizing.
> 
> Not when I tried, although lint might catch this.  
> 
> One reason gcc misses it may be that all-bits-zero pointer is valid on
> some platforms (I think).  Feel free to suggest this to the gcc
> maintainers though.

> My point though was not regarding the example code.  I am merely
> suggesting to up the warning level to something more extreme when
> compiling the problem code, in order to see how clean it really is and
> perhaps weed out a bug.  I should add that of course I don't know what
> warnings you are using (and so what you mean by clean code) - maybe
> you already did this.

no -W switch, the only warnings I accept are about implicit conversions
between int and double since an explicit typecast for such a conversion
(static_cast) looks terrible. Since I often use long double and I do not
like C cast notation, but long double a = long double (b) does not work, I
consequently cast implicitly between the both.

Of course I try to raise the warnings (-Wall) to find errorneous code that
I do not find when debugging. But I am tired of a bug in RHIDE that often
causes problems when using -Wall:

template <class C> C intconv (C c)
{
 int i = c;
 return i;
}

int main ()
{
 intconv (1.2);
 return 0;
}

compiles when warnings are off, compiles from console when warnings are
on, but RHIDE says:

Compiling: x.cpp
In function `double intconv<double>(double>':
x.cpp (9) Error: instantiated from here
x.cpp (3) Warning:  initialization to `int' from `double'
There were some errors

gcc says:

x.cpp: In function `double intconv<double>(double)':
x.cpp:9    instantiated from here
x.cpp:3 warning: initialization to `int' from `double'

> I'm kinda loosing the thread here, are you saying you only get SIGSEGV
> under Windows ME?  Did you try your program under real-mode DOS (from
> boot floppy)?

With the DOS mode patch, I get the correct messages (not every time a
GPF).

-- 
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.

- Raw text -


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