Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #150431

Re: Best C compiler

Subject Re: Best C compiler
Newsgroups comp.lang.c
References (7 earlier) <GO98G.878236$hD4.281101@fx47.iad> <r3ra1o$g03$1@news.albasani.net> <82243571-87ae-4249-83c8-4b983e5dc03e@googlegroups.com> <r3re0e$7oo$1@news.albasani.net> <5e11d2a8-8e38-45cc-918b-aade1d1c7027@googlegroups.com>
From Richard Damon <Richard@Damon-Family.org>
Message-ID <SEQ8G.3175$3U5.2985@fx01.iad> (permalink)
Organization Forte - www.forteinc.com
Date 2020-03-07 12:15 -0500

Show all headers | View raw


On 3/6/20 4:56 AM, Malcolm McLean wrote:
> On Thursday, 5 March 2020 17:48:08 UTC, Bonita Montero  wrote:
>>> Depends on the code. Debuggers are useful if the error occurs on the
>>> first few iterations of the code.
>>
>> Do you know conditional breakpoints ?
>>
>>> However if it takes many iterations before the bug becomes evident,
>>> a printf trace of the program's state can be more useful.
>>
>> Yeeees, a printf every iteration for a lot iterations.
>> Makes _perfectly_ sense to me.
>> printf()-debugging is a shit.
>>
> Say that we have the line
> y = 1/x;
> 
> x goes to zero and it crashes. Now we could break on x == 0, but that won't tell us what happened to x before it went to zero. Or we could break on fabs(x) < epsilon, but what do we use for epsilon, how do we set up the condition in the debugger, and will it give us false positives?
> 
> if we put in the line
> printf("x = %e\n", x);
> 
> then we get a list of all values of x before x goes to zero. There might be 
> ten thousand of them. But likely things start to go wrong in the last hundred 
> or so. We might see x gradually decrease in absolute value, wildly oscillate, or get into a pattern of alternating positive and negative values which steadily get lower. Or it might not be that all values until the last one look fine,
> but we have a few isolated very low values further up in the trace.
> The printf() method allows us to quickly monitor the state of the variable.
> 

Another alternative, that doesn't generate as long of an output is to
instrument the code to save the values of x in an array being used as a
circular buffer. Then when x takes on the bad value, you can look at
just the recent history of the changes.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Best C compiler "Usenet Advocate #1337" <test@dont-email.me> - 2020-03-03 22:38 -0500
  Re: Best C compiler Melzzzzz <Melzzzzz@zzzzz.com> - 2020-03-04 04:36 +0000
  Re: Best C compiler Autist <autist69@gmail.com> - 2020-03-04 07:16 +0100
    Re: Best C compiler "Usenet Advocate #1337" <test@dont-email.me> - 2020-03-04 18:48 -0500
      Re: Best C compiler Autist <autist69@gmail.com> - 2020-03-05 06:14 +0100
  Re: Best C compiler already5chosen@yahoo.com - 2020-03-04 01:05 -0800
  Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-04 11:04 +0000
    Re: Best C compiler Real Troll <Real.Troll@Trolls.com> - 2020-03-04 07:25 -0400
      Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-04 11:35 +0000
      Re: Best C compiler gazelle@shell.xmission.com (Kenny McCormack) - 2020-03-04 13:10 +0000
        Re: Best C compiler chad <cdalten@gmail.com> - 2020-03-04 06:12 -0800
      Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-04 10:00 -0800
        Re: Best C compiler Real Troll <real.troll@trolls.com> - 2020-03-04 22:59 -0400
    Re: Best C compiler gazelle@shell.xmission.com (Kenny McCormack) - 2020-03-04 13:07 +0000
  Re: Best C compiler fir <profesor.fir@gmail.com> - 2020-03-04 06:26 -0800
    Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-04 18:08 +0100
      Re: Best C compiler chad <cdalten@gmail.com> - 2020-03-04 09:26 -0800
        Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-04 18:31 +0100
          Re: Best C compiler scott@slp53.sl.home (Scott Lurndal) - 2020-03-04 22:31 +0000
            Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-05 06:44 +0100
              Re: Best C compiler Real Troll <real.troll@trolls.com> - 2020-03-05 03:20 -0400
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-05 08:22 +0100
              Re: Best C compiler scott@slp53.sl.home (Scott Lurndal) - 2020-03-05 16:30 +0000
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-05 17:40 +0100
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-05 08:55 -0800
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-05 18:47 +0100
                Re: Best C compiler chad <cdalten@gmail.com> - 2020-03-05 10:06 -0800
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-05 20:12 +0100
                Re: Best C compiler chad <cdalten@gmail.com> - 2020-03-05 11:53 -0800
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-06 01:56 -0800
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-06 14:41 +0100
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-06 05:48 -0800
                Re: Best C compiler chad <cdalten@gmail.com> - 2020-03-06 06:23 -0800
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-06 07:01 -0800
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-06 16:09 +0100
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-06 09:52 -0800
                Re: Best C compiler Guillaume <message@bottle.org> - 2020-03-06 19:11 +0100
                Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-08 09:10 +0000
                Re: Best C compiler Guillaume <message@bottle.org> - 2020-03-08 16:08 +0100
                Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-08 18:21 +0000
                Re: Best C compiler Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2020-03-08 14:57 -0400
                Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-08 19:32 +0000
                Re: Best C compiler Christopher Collins <ccollins476ad@gmail.com> - 2020-03-09 12:44 -0700
                Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-10 07:22 +0000
                Re: Best C compiler "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-03-08 14:34 -0700
                tsan (was Re: Best C compiler) Vir Campestris <vir.campestris@invalid.invalid> - 2020-03-11 21:55 +0000
                Re: tsan (was Re: Best C compiler) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-03-11 15:21 -0700
                Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-06 15:27 +0100
                Re: Best C compiler Richard Damon <Richard@Damon-Family.org> - 2020-03-07 12:15 -0500
                Re: Best C compiler Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-07 17:50 +0000
                Re: Best C compiler Richard Damon <Richard@Damon-Family.org> - 2020-03-07 13:00 -0500
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-08 06:16 -0700
                Re: Best C compiler Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-08 13:39 +0000
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-10 13:44 -0700
                Re: Best C compiler Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-11 03:34 +0000
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-11 03:27 -0700
                Re: Best C compiler Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-11 15:28 +0000
                Re: Best C compiler Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-12 02:51 -0700
                Re: Best C compiler Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-12 11:58 +0000
                Re: Best C compiler Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-03-27 07:01 -0700
                Re: Best C compiler Bart <bc@freeuk.com> - 2020-03-11 16:08 +0000
                Re: Best C compiler Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-08 09:17 +0000
                Re: Best C compiler Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-05 23:32 +0000
                Re: Best C compiler David Brown <david.brown@hesbynett.no> - 2020-03-06 12:37 +0100
      Re: Best C compiler fir <profesor.fir@gmail.com> - 2020-03-04 14:52 -0800
  Re: Best C compiler jacobnavia <jacob@jacob.remcomp.fr> - 2020-03-04 22:09 +0100
  Re: Best C compiler Philipp Klaus Krause <pkk@spth.de> - 2020-03-05 08:48 +0100
    Re: Best C compiler Bonita Montero <Bonita.Montero@gmail.com> - 2020-03-05 12:29 +0100
      Re: Best C compiler David Brown <david.brown@hesbynett.no> - 2020-03-05 12:41 +0100
  Re: Best C compiler "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-03-06 12:11 -0800

csiph-web