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


Groups > comp.lang.c > #142964

Re: Application Exercises

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Application Exercises
Date 2019-04-10 08:15 -0700
Organization A noiseless patient Spider
Message-ID <86d0ltki2n.fsf@mailhub.linuxsc.com> (permalink)
References (1 earlier) <T86qE.57301$hJ3.14005@fx07.iad> <86pnpvjtr7.fsf@mailhub.linuxsc.com> <klcrE.497694$Z%2.459897@fx48.iad> <86h8b6jyys.fsf@mailhub.linuxsc.com> <XKjrE.266190$7C4.31546@fx33.iad>

Show all headers | View raw


Richard Damon <Richard@Damon-Family.org> writes:

> On 4/9/19 11:55 PM, Tim Rentsch wrote:
>
>> The code I wrote has one pre-processor comparison, to allow the
>> code to work in different versions of C.  The test is this:
>>
>>     #if __STDC_VERSION__ > 199900
>>
>
> I guess that you need the __STDC_VERSION__ test to know a name for
> the largest signed type and not assuming you are dealing with an
> int, but some arbitrary integer type.

Yes.  I wanted one routine for all signed types.  The natural
type for that is intmax_t, but that isn't available in pre-C99
environments, hence the pre-processor test.

> Thinking about it a bit more, I think I can figure out how to
> do this differently without needing the size of an int.

Great!  Reading your comments also has given me an idea for
an improvement to my previous solution.

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


Thread

Re: Application Exercises Richard Damon <Richard@Damon-Family.org> - 2019-04-06 14:23 -0400
  Re: Application Exercises Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-04-09 04:35 -0700
    Re: Application Exercises Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-09 13:29 +0100
      Re: Application Exercises Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-04-09 08:02 -0700
    Re: Application Exercises Richard Damon <Richard@Damon-Family.org> - 2019-04-09 22:15 -0400
      Re: Application Exercises Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-04-09 20:55 -0700
        Re: Application Exercises Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-04-09 22:21 -0600
          Re: Application Exercises Richard Damon <Richard@Damon-Family.org> - 2019-04-10 06:31 -0400
          Re: Application Exercises James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-04-10 07:43 -0400
        Re: Application Exercises Richard Damon <Richard@Damon-Family.org> - 2019-04-10 06:40 -0400
          Re: Application Exercises Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-04-10 08:15 -0700
      Re: Application Exercises James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-04-10 07:37 -0400

csiph-web