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


Groups > comp.lang.c > #62183 > unrolled thread

determines if it is a signed type

Started byasetofsymbols@gmail.com
First post2015-05-17 10:07 -0700
Last post2015-05-18 00:40 -0700
Articles 2 on this page of 62 — 14 participants

Back to article view | Back to comp.lang.c


Contents

  determines if it is a signed type asetofsymbols@gmail.com - 2015-05-17 10:07 -0700
    Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-17 18:12 +0100
      Re: determines if it is a signed type asetofsymbols@gmail.com - 2015-05-17 10:34 -0700
        Re: determines if it is a signed type asetofsymbols@gmail.com - 2015-05-17 11:09 -0700
        Re: determines if it is a signed type Kusalananda <kusalananda@example.com> - 2015-05-17 18:22 +0000
          Re: determines if it is a signed type asetofsymbols@gmail.com - 2015-05-17 11:31 -0700
            Re: determines if it is a signed type Kusalananda <kusalananda@example.com> - 2015-05-17 19:59 +0000
    Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-17 13:12 -0700
    Re: determines if it is a signed type Morris Dovey <mrdovey@iedu.com> - 2015-05-17 19:08 -0500
      Re: determines if it is a signed type Morris Dovey <mrdovey@iedu.com> - 2015-05-17 19:46 -0500
      Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-18 01:59 +0100
        Re: determines if it is a signed type Morris Dovey <mrdovey@iedu.com> - 2015-05-17 20:10 -0500
        Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-18 00:37 -0700
          Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-18 21:15 +0100
            Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-18 15:15 -0700
          Re: determines if it is a signed type glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-18 21:51 +0000
            Re: determines if it is a signed type James Kuyper <jameskuyper@verizon.net> - 2015-05-18 18:00 -0400
        Re: determines if it is a signed type glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-18 14:37 +0000
          Re: determines if it is a signed type jacobnavia <jacob@jacob.remcomp.fr> - 2015-05-18 17:09 +0200
            Re: determines if it is a signed type glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-18 18:14 +0000
      Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-18 06:34 +0100
        Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-18 00:43 -0700
          Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-18 13:56 +0100
            Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-18 08:00 -0700
              Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-18 20:35 +0100
                Re: determines if it is a signed type jacobnavia <jacob@jacob.remcomp.fr> - 2015-05-18 23:08 +0200
                  Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-18 22:32 +0100
                    Re: determines if it is a signed type jacobnavia <jacob@jacob.remcomp.fr> - 2015-05-19 00:44 +0200
                      Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-19 00:05 +0100
                        Re: determines if it is a signed type jacobnavia <jacob@jacob.remcomp.fr> - 2015-05-19 01:43 +0200
                          Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-19 01:08 +0100
                            Re: determines if it is a signed type "Bartc" <bartc@freeuk.com> - 2015-05-19 11:33 +0100
                              Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-19 08:15 -0700
                                Re: determines if it is a signed type "Bartc" <bartc@freeuk.com> - 2015-05-19 19:36 +0100
                                  Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-19 11:55 -0700
                            Re: determines if it is a signed type jacobnavia <jacob@jacob.remcomp.fr> - 2015-05-19 11:39 +0200
                              Re: determines if it is a signed type "Bartc" <bartc@freeuk.com> - 2015-05-19 11:44 +0100
                                Re: determines if it is a signed type jacobnavia <jacob@jacob.remcomp.fr> - 2015-05-19 12:11 +0200
                              Re: determines if it is a signed type jadill33@gmail.com - 2015-05-19 05:45 -0700
                                Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-19 15:03 +0100
                                  Re: determines if it is a signed type jadill33@gmail.com - 2015-05-19 08:46 -0700
                                    Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-19 17:08 +0100
                                      Re: determines if it is a signed type jadill33@gmail.com - 2015-05-19 09:52 -0700
                                        Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-19 20:36 +0100
                                          Re: determines if it is a signed type jadill33@gmail.com - 2015-05-20 07:40 -0700
                                            Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-20 23:12 +0100
                                              Re: determines if it is a signed type jadill33@gmail.com - 2015-05-21 13:52 -0700
                                                Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-21 22:48 +0100
                                                  Re: determines if it is a signed type jadill33@gmail.com - 2015-05-22 05:50 -0700
                                                    Re: determines if it is a signed type Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-22 23:14 +0100
                                                      Re: determines if it is a signed type jadill33@gmail.com - 2015-05-26 14:31 -0700
                                            Re: determines if it is a signed type Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-22 23:32 -0700
                                  Re: determines if it is a signed type David Brown <david.brown@hesbynett.no> - 2015-05-20 12:26 +0200
                              Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-19 15:28 +0100
                                Re: determines if it is a signed type raltbos@xs4all.nl (Richard Bos) - 2015-05-23 10:37 +0000
                Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-18 15:21 -0700
                  Re: determines if it is a signed type Richard Heathfield <rjh@cpax.org.uk> - 2015-05-19 00:04 +0100
                    Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-19 08:03 -0700
                  Re: determines if it is a signed type David Brown <david.brown@hesbynett.no> - 2015-05-19 08:47 +0200
                    Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-19 08:07 -0700
            Re: determines if it is a signed type James Kuyper <jameskuyper@verizon.net> - 2015-05-18 11:28 -0400
      Re: determines if it is a signed type Keith Thompson <kst-u@mib.org> - 2015-05-18 00:40 -0700

Page 4 of 4 — ← Prev page 1 2 3 [4]


#62223

FromJames Kuyper <jameskuyper@verizon.net>
Date2015-05-18 11:28 -0400
Message-ID<555A0502.10408@verizon.net>
In reply to#62217
On 05/18/2015 08:56 AM, Richard Heathfield wrote:
> On 18/05/15 08:43, Keith Thompson wrote:
>> Richard Heathfield <rjh@cpax.org.uk> writes:
...
>>> OP: look at the definition. Really.
>>
>> How can I portably print the value returned by time(NULL)?  Looking at
>> the definition doesn't help.
> 
> According to N1570, time() returns a time_t, which is a "real type". 

Older versions of the standard specified "arithmetic type". I think my
discussion of the possible problems if clock_t or time_t were typedefs
for "double _Imaginary" ;-) was at least partially responsible for the
change.

> That means it could be an integer type or a floating point type. So the 
> best we can do with time(NULL) in the absence of a time_t conversion 
> specifier is to cast to the widest supported floating point type, 
> presumably long double. ...

time_t could be an integer type so wide that it's full precision might
not survive conversion to the widest available floating point type.
Since we can in fact test to determine whether it is a floating point or
integer type, "the best we can do" would not involve ignoring that issue.
If it is an integer type, it would generally be best to print it using
either a signed or unsigned type, depending upon whether time_t is
signed or unsigned. This is also testable, so "the best we can do" would
test that.

> ...We would do better to use gmtime or localtime 
> followed by strftime to get a string in a reliable format, and then 
> print that.

In general, I would agree - except when debugging with the goal of
trying to figure out why gmtime(), localtime() or strftime() are
producing unexpected results.

[toc] | [prev] | [next] | [standalone]


#62215

FromKeith Thompson <kst-u@mib.org>
Date2015-05-18 00:40 -0700
Message-ID<87r3qeqqns.fsf@kst-u.example.com>
In reply to#62207
Morris Dovey <mrdovey@iedu.com> writes:
> On 5/17/15 12:07 PM, asetofsymbols@gmail.com wrote:
>> Is there any better way?
>
> Of course - look at the declaration!
[...]

Looking at the declaration isn't always a possibility. For example you
might want to write a macro that will print an expression of any numeric
type, or you might be dealing with the typedef whose characteristics can
vary from one implementation to another.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [standalone]


Page 4 of 4 — ← Prev page 1 2 3 [4]

Back to top | Article view | comp.lang.c


csiph-web