* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
@ 1996-08-19 4:00 ` Thomas Graichen
1996-10-17 4:00 ` sukumar
1996-08-27 4:00 ` Martin Ibert
` (10 subsequent siblings)
11 siblings, 1 reply; 56+ messages in thread
From: Thomas Graichen @ 1996-08-19 4:00 UTC (permalink / raw)
Matt Houseman x4408 (mhouseman@arborsoft.com) wrote:
: If it were completely up to me, I would choose Solaris 'cause if
: you can get your app to run on Solaris, it'll run on anything!
. for that point you would run better with NetBSD or linux ... i think
anything is more than just x86, sparc and maybe something more ... :-)
t
--
thomas graichen graichen@mail.physik.fu-berlin.de graichen@FreeBSD.org
perfection is reached, not when there is no longer anything to add, but when
there is no longer anything to take away antoine de saint-exupery
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
1996-08-19 4:00 ` Thomas Graichen
@ 1996-08-27 4:00 ` Martin Ibert
1996-08-29 4:00 ` Mike Miscevic
1996-08-29 4:00 ` Wojciech Galazka
1996-09-02 4:00 ` mib
` (9 subsequent siblings)
11 siblings, 2 replies; 56+ messages in thread
From: Martin Ibert @ 1996-08-27 4:00 UTC (permalink / raw)
In article <32189D13.3834@arborsoft.com> Matt Houseman x4408 <mhouseman@arborsoft.com> writes:
: If it were completely up to me, I would choose Solaris 'cause if
: you can get your app to run on Solaris, it'll run on anything!
Not so. (Really, I'm talking from experience.) I do subscribe to your
line of reasoning, but Solaris is not the the way to. No platform that
has sizeof(int) == sizeof(long) resp. sizeof(int) == sizeof(void*)
should be your choice in this case.
In porting your average vintage UN*X app, you'll encounter endless
headaches from missing prototypes, wrong *printf formats, free mixing
of int and long, ...
Before I first came across a 64-bit-UN*X, I'd also recommended
Solaris. These days, I'd recommand Digital UNIX.
--
---------------------------------------------------------------------------
Dipl.-Inform. Martin Ibert, BB-DATA GmbH, Brunnenstra�e 111, D-13355 Berlin
E-Mail <mib@ppe.bb-data.de> - Phone +49-30-245-56582 - Fax +49-30-245-56577
\/\Disclaimer: My views do not necessarily reflect those of my employer./\/
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-27 4:00 ` Martin Ibert
@ 1996-08-29 4:00 ` Mike Miscevic
1996-09-04 4:00 ` Patrick Horgan
1996-08-29 4:00 ` Wojciech Galazka
1 sibling, 1 reply; 56+ messages in thread
From: Mike Miscevic @ 1996-08-29 4:00 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1373 bytes --]
Martin Ibert (mib@bb-data.de) wrote:
: In article <32189D13.3834@arborsoft.com> Matt Houseman x4408 <mhouseman@arborsoft.com> writes:
:
: : If it were completely up to me, I would choose Solaris 'cause if
: : you can get your app to run on Solaris, it'll run on anything!
:
: Not so. (Really, I'm talking from experience.) I do subscribe to your
: line of reasoning, but Solaris is not the the way to. No platform that
: has sizeof(int) == sizeof(long) resp. sizeof(int) == sizeof(void*)
: should be your choice in this case.
:
: In porting your average vintage UN*X app, you'll encounter endless
: headaches from missing prototypes, wrong *printf formats, free mixing
: of int and long, ...
:
: Before I first came across a 64-bit-UN*X, I'd also recommended
: Solaris. These days, I'd recommand Digital UNIX.
: --
: ---------------------------------------------------------------------------
: Dipl.-Inform. Martin Ibert, BB-DATA GmbH, Brunnenstra�e 111, D-13355 Berlin
: E-Mail <mib@ppe.bb-data.de> - Phone +49-30-245-56582 - Fax +49-30-245-56577
: \/\Disclaimer: My views do not necessarily reflect those of my employer./\/
--
Mike Miscevic email: mmiscevi@on.bell.ca
Bell Sygma Telecom Solutions IIS: MMISCEVI
160 Elgin Street, room 550 phone: (613) 781-4361
Ottawa, Ontario K2P 2C4 fax: (613) 238-7772
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-29 4:00 ` Mike Miscevic
@ 1996-09-04 4:00 ` Patrick Horgan
0 siblings, 0 replies; 56+ messages in thread
From: Patrick Horgan @ 1996-09-04 4:00 UTC (permalink / raw)
In article <DwvqEq.8BK@on.bell.ca>, mmiscevi@on.bell.ca (Mike Miscevic) writes:
> Martin Ibert (mib@bb-data.de) wrote:
> : In article <32189D13.3834@arborsoft.com> Matt Houseman x4408 <mhouseman@arborsoft.com> writes:
> :
> : : If it were completely up to me, I would choose Solaris 'cause if
> : : you can get your app to run on Solaris, it'll run on anything!
> :
> : Not so. (Really, I'm talking from experience.) I do subscribe to your
> : line of reasoning, but Solaris is not the the way to. No platform that
> : has sizeof(int) == sizeof(long) resp. sizeof(int) == sizeof(void*)
> : should be your choice in this case.
> :
Don't make the mistake of thinking that this is platform dependent. I've worked
on platforms where one compiler had sizeof(int) == sizeof(long) and a compiler
from another vendor had sizeof(int) < sizeof(long). The relationship of int and
long is not a platform issue but an implementation detail. (Of course the
specs say that sizeof(int)<=sizeof(long) ). I've seen other compilers where
this was dependent on compiler flags.
--
Patrick J. Horgan patrick@broadvision.com Have horse will ride.
Opinions mine, not my employer's except by most bizarre coincidence.
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-27 4:00 ` Martin Ibert
1996-08-29 4:00 ` Mike Miscevic
@ 1996-08-29 4:00 ` Wojciech Galazka
1996-08-29 4:00 ` Scott G. Hall
1 sibling, 1 reply; 56+ messages in thread
From: Wojciech Galazka @ 1996-08-29 4:00 UTC (permalink / raw)
In article <kiawwyl8j89.fsf@laforge.ppe.bb-data.de> mib@bb-data.de (Martin Ibert) writes:
>From: mib@bb-data.de (Martin Ibert)
>Subject: Re: best UNIX OS as primary platform for UNIX system software develpoment?
>Date: 27 Aug 1996 07:54:46 +0200
>Before I first came across a 64-bit-UN*X, I'd also recommended
>Solaris. These days, I'd recommand Digital UNIX.
>--
Try Linux first.
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-29 4:00 ` Wojciech Galazka
@ 1996-08-29 4:00 ` Scott G. Hall
1996-08-30 4:00 ` Timothy M. Wieman
` (3 more replies)
0 siblings, 4 replies; 56+ messages in thread
From: Scott G. Hall @ 1996-08-29 4:00 UTC (permalink / raw)
Wojciech Galazka <wgalazka@zoolook.chem.uw.edu.pl> wrote:
>mib@bb-data.de (Martin Ibert) writes:
>>From: mib@bb-data.de (Martin Ibert)
>>Subject: Re: best UNIX OS as primary platform for UNIX system software develpoment?
>>Date: 27 Aug 1996 07:54:46 +0200
>
>>Before I first came across a 64-bit-UN*X, I'd also recommended
>>Solaris. These days, I'd recommand Digital UNIX.
>>
>Try Linux first.
No -- Linux has the same problem: sizeof(int) == sizeof(long). You need
something where these are different.
--
"It was our last, best hope for peace -- it failed. | Scott G. Hall
Now it's our last best hope." (Babylon-5 opener) | Lucent Technologies
----------------------------------------------------------| Bell Labs - BCS
Scott.Hall@bell-labs.com sgh@cbgbcs.cb.lucent.com | Columbus, OH, USA
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-29 4:00 ` Scott G. Hall
@ 1996-08-30 4:00 ` Timothy M. Wieman
1996-08-30 4:00 ` Jon Reeves
` (2 subsequent siblings)
3 siblings, 0 replies; 56+ messages in thread
From: Timothy M. Wieman @ 1996-08-30 4:00 UTC (permalink / raw)
Scott G. Hall (sgh@cbgbcs.cb.att.com) wrote:
> Wojciech Galazka <wgalazka@zoolook.chem.uw.edu.pl> wrote:
> >mib@bb-data.de (Martin Ibert) writes:
> >>From: mib@bb-data.de (Martin Ibert)
> >>Subject: Re: best UNIX OS as primary platform for UNIX system software develpoment?
> >>Date: 27 Aug 1996 07:54:46 +0200
> >
> >>Before I first came across a 64-bit-UN*X, I'd also recommended
> >>Solaris. These days, I'd recommand Digital UNIX.
> >>
> >Try Linux first.
>
> No -- Linux has the same problem: sizeof(int) == sizeof(long). You need
> something where these are different.
I've also got to plug a 64-bit-UN*X (in my case Digital UNIX). We do
a lot of malloc'ing large chunks, pointing fields of structures into these
chunks, and then later dereferencing these pointers. Alignment becomes
a big issue in this case, and a 64-bit UN*X (at least Digital UNIX)
makes the structs be aligned on an 8 byte bound. Well, if it's aligned
on 8 byte, it'll also be aligned on 4 byte for the 32-bit platforms.
Another good thing (I think) about Digital UNIX is that it will NOT let
you dereference a NULL pointer (some may argue that this is valid,
though). Other OS's I've worked on WILL let you do this (AIX, SCO,
UnixWare, Interactive, DG-UX, and I believe HP-UX). Don't know about
IRIX and Solaris.
Just my 2 pennies -- Tim
--
------------------------------------------------------------------------
Timothy M. Wieman | PACE Health Management Systems
Software Engineer | 1025 Ashworth Rd. Suite 200 Voice: 515.222.1717
timw@hces.com | West Des Moines, IA 50265 Fax: 515.222.1716
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-29 4:00 ` Scott G. Hall
1996-08-30 4:00 ` Timothy M. Wieman
@ 1996-08-30 4:00 ` Jon Reeves
1996-08-30 4:00 ` R!ch
1996-09-01 4:00 ` John J. Rushford
3 siblings, 0 replies; 56+ messages in thread
From: Jon Reeves @ 1996-08-30 4:00 UTC (permalink / raw)
In article <5050gc$1fc@nntpa.cb.lucent.com>, sgh@cbgbcs.cb.att.com (Scott G. Hall) writes:
|> No -- Linux has the same problem: sizeof(int) == sizeof(long). You need
|> something where these are different.
Like, for instance, Linux (when run on an Alpha platform, that is).
(Though I personally do more software development on Digital UNIX, for obvious
reasons.)
--
Jon Reeves Digital UNIX Software Group reeves@zk3.dec.com
MA/NH movie schedules: http://www.sai.com/movies/ or "help" to mtw@zk3.dec.com
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-29 4:00 ` Scott G. Hall
1996-08-30 4:00 ` Timothy M. Wieman
1996-08-30 4:00 ` Jon Reeves
@ 1996-08-30 4:00 ` R!ch
1996-09-01 4:00 ` John J. Rushford
3 siblings, 0 replies; 56+ messages in thread
From: R!ch @ 1996-08-30 4:00 UTC (permalink / raw)
To: Scott G. Hall
On 29 Aug 1996, Scott G. Hall wrote:
> Wojciech Galazka <wgalazka@zoolook.chem.uw.edu.pl> wrote:
> >mib@bb-data.de (Martin Ibert) writes:
> >>From: mib@bb-data.de (Martin Ibert)
> >>Subject: Re: best UNIX OS as primary platform for UNIX system software develpoment?
> >>Date: 27 Aug 1996 07:54:46 +0200
> >
> >>Before I first came across a 64-bit-UN*X, I'd also recommended
> >>Solaris. These days, I'd recommand Digital UNIX.
> >>
> >Try Linux first.
>
> No -- Linux has the same problem: sizeof(int) == sizeof(long). You need
> something where these are different.
Not sure I agree here. Certainly, one should code assuming that
sizeof (int) != sizeof (long). And more to the point (no pun intended!),
sizeof ({int, long}) != sizeof (void *).
I guess using a machine for which the above cases are true helps, but IMHO,
a good programmer should make no such assumptions.
---
R!ch
If it ain't analogue, it ain't music.
#include <disclaimer.h> \\|// - ?
(o o)
/==================================oOOo=(_)=oOOo========\
| Richard Teer richard.teer@uk.sun.com |
| Sun Service Contractor |
| Voice: +44 (0)1276 691974 |
\=======================================================/
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-29 4:00 ` Scott G. Hall
` (2 preceding siblings ...)
1996-08-30 4:00 ` R!ch
@ 1996-09-01 4:00 ` John J. Rushford
1996-09-02 4:00 ` Pawel Wezgowiec
3 siblings, 1 reply; 56+ messages in thread
From: John J. Rushford @ 1996-09-01 4:00 UTC (permalink / raw)
Scott G. Hall (sgh@cbgbcs.cb.att.com) wrote:
: Wojciech Galazka <wgalazka@zoolook.chem.uw.edu.pl> wrote:
: >mib@bb-data.de (Martin Ibert) writes:
: >>From: mib@bb-data.de (Martin Ibert)
: >>Subject: Re: best UNIX OS as primary platform for UNIX system software develpoment?
: >>Date: 27 Aug 1996 07:54:46 +0200
: >
: >>Before I first came across a 64-bit-UN*X, I'd also recommended
: >>Solaris. These days, I'd recommand Digital UNIX.
: >>
: >Try Linux first.
: No -- Linux has the same problem: sizeof(int) == sizeof(long). You need
: something where these are different.
sizeof(int) == sizeof(long) is true on a lot of UNIX platforms not just Linux
or Solaris x86 and has been for a long time. Just curious as to why you use
this criteria to judge which OS to use.
John
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-01 4:00 ` John J. Rushford
@ 1996-09-02 4:00 ` Pawel Wezgowiec
0 siblings, 0 replies; 56+ messages in thread
From: Pawel Wezgowiec @ 1996-09-02 4:00 UTC (permalink / raw)
On Sun, 1 Sep 1996, John J. Rushford wrote:
> Scott G. Hall (sgh@cbgbcs.cb.att.com) wrote:
> : Wojciech Galazka <wgalazka@zoolook.chem.uw.edu.pl> wrote:
> : >mib@bb-data.de (Martin Ibert) writes:
> : No -- Linux has the same problem: sizeof(int) == sizeof(long). You need
> : something where these are different.
>
> sizeof(int) == sizeof(long) is true on a lot of UNIX platforms not just Linux
> or Solaris x86 and has been for a long time. Just curious as to why you use
> this criteria to judge which OS to use.
>
Hmm...
This complicated piece of code I run on our HP9000 K200 under HP-UX
10.01:
-------------------------------------
#include <iostream.h>
int main()
{
cout << "Size of int = " << sizeof(int) << endl;
cout << "Size of long = " << sizeof(long) << endl;
cout << "Size of long long = " << sizeof(long long) << endl;
return 0;
}
-------------------------------
I compiled it with gcc 2.7.2.1 (I haven't got HP C++,
and I don't want to rewrite it to "printf version" to compile
it with the original cc) - AFAIK the result would be the same
with the original one.
What was the output ?
-----------------------------
Size of int = 4
Size of long = 4
Size of long long = 8
-------------------------------
Is HP-UX that bad platform ??
Probably there are more Unix systems with
sizeof(int) == sizeof(long). But I don't think it's
really important.
If I were you I'd focused on the quality of development tools
for the "recommended platform".
Assuming size of data types is one of the best ways to
write code very hard to maintain. Along with some other
"hard-coded" code it would be not the primary but the only
platform for your application.
Paul
=======================================================================
Pawel Wezgowiec | Technical University of Czestochowa
| Institute of Mathematics
Network Administrator | and Computer Science
=======================================================================
http://k2.pcz.czest.pl/~paulw
=======================================================================
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
1996-08-19 4:00 ` Thomas Graichen
1996-08-27 4:00 ` Martin Ibert
@ 1996-09-02 4:00 ` mib
1996-09-02 4:00 ` Robert Lipe
1996-09-02 4:00 ` mib
` (8 subsequent siblings)
11 siblings, 1 reply; 56+ messages in thread
From: mib @ 1996-09-02 4:00 UTC (permalink / raw)
timw@isac.hces.com (Timothy M. Wieman) writes:
> Another good thing (I think) about Digital UNIX is that it will NOT let
> you dereference a NULL pointer (some may argue that this is valid,
> though). Other OS's I've worked on WILL let you do this (AIX, SCO,
> UnixWare, Interactive, DG-UX, and I believe HP-UX). Don't know about
> IRIX and Solaris.
Solaris shoots dereferenced NULLs on sight (which is why I used to
recommend it). So does HP-UX if you let it (it's optional). So does Linux.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-02 4:00 ` mib
@ 1996-09-02 4:00 ` Robert Lipe
1996-09-04 4:00 ` Tom Kelly
0 siblings, 1 reply; 56+ messages in thread
From: Robert Lipe @ 1996-09-02 4:00 UTC (permalink / raw)
In <uraoltob2.fsf@ppe.bb-data.de> mib@ppe.bb-data.de writes:
>timw@isac.hces.com (Timothy M. Wieman) writes:
>> Another good thing (I think) about Digital UNIX is that it will NOT let
>> you dereference a NULL pointer (some may argue that this is valid,
>> though). Other OS's I've worked on WILL let you do this (AIX, SCO,
>> UnixWare, Interactive, DG-UX, and I believe HP-UX). Don't know about
>> IRIX and Solaris.
>Solaris shoots dereferenced NULLs on sight (which is why I used to
>recommend it). So does HP-UX if you let it (it's optional). So does Linux.
Just for completness of your list, SCO OpenServer 5 has two kernel
tunables to allow you adjust the behaviour.
'notice_null_refs' prints the PID, name, etc. of the process on
the console. Clearly, this is useful only if you're sitting
at the console or are otherwise watching /var/adm/messages.
'signal_null_refs' delivers a signal to the offenders.
Yes, it's smart enough to look at the object file format and know if
a NULL deref really is valid. For example, on an OMF (xenix) binary,
it's legal so it won't whine or signal. For an ELF binary, it's never
legal, so it invokes the appropriate militant behaviour.
--
Robert Lipe
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-02 4:00 ` Robert Lipe
@ 1996-09-04 4:00 ` Tom Kelly
0 siblings, 0 replies; 56+ messages in thread
From: Tom Kelly @ 1996-09-04 4:00 UTC (permalink / raw)
Robert Lipe wrote:
>
> In <uraoltob2.fsf@ppe.bb-data.de> mib@ppe.bb-data.de writes:
>
>
> Just for completness of your list, SCO OpenServer 5 has two kernel
> tunables to allow you adjust the behaviour.
>
> 'notice_null_refs' prints the PID, name, etc. of the process on
> the console. Clearly, this is useful only if you're sitting
> at the console or are otherwise watching /var/adm/messages.
>
> 'signal_null_refs' delivers a signal to the offenders.
Sometimes changing kernel configuration parameters is not possible (you
aren't root, or your threats are insufficiently terrifying. :-)) or
inadvisable (you don't want to change the behaviour for everyone).
On ftp.sco.com in TLS/tls594.* is a little program that allows you to
trap
null pointer references on a case-by-case basis.
Tom Kelly
tom@mks.com
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (2 preceding siblings ...)
1996-09-02 4:00 ` mib
@ 1996-09-02 4:00 ` mib
1996-09-03 4:00 ` Chuck Dillon
` (7 subsequent siblings)
11 siblings, 0 replies; 56+ messages in thread
From: mib @ 1996-09-02 4:00 UTC (permalink / raw)
wjjr@sapphire.alisa.org (John J. Rushford) writes:
> sizeof(int) == sizeof(long) is true on a lot of UNIX platforms not just Linux
> or Solaris x86 and has been for a long time. Just curious as to why you use
> this criteria to judge which OS to use.
Take another look at the subject. For primary development, use the
platform that is most unforgiving when it comes to coding errors, and
port to more lenient platforms. The other way around it is a nightmare (believe
me--I've been there). Two of the most frequent coding errors in the
UNIX developer community (precisely because it is, as you say, common
to have int and long to be identical) is to confuse ints and longs,
especially when it comes to passing parameters, mixing pointers, and
*printf formats, and "tunneling" pointer values through int variables
and arguments. Try porting a 100.000+ lines of code application laced
with these bugs to Digital Unix *shudder*. If you code for dUNIX
first, you'll catch these buggers up-front. Plus, you learn to avoid them.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (3 preceding siblings ...)
1996-09-02 4:00 ` mib
@ 1996-09-03 4:00 ` Chuck Dillon
1996-09-03 4:00 ` Poll Dubh
1996-09-06 4:00 ` Paul T. Wilson
1996-09-03 4:00 ` Martin Knoblauch
` (6 subsequent siblings)
11 siblings, 2 replies; 56+ messages in thread
From: Chuck Dillon @ 1996-09-03 4:00 UTC (permalink / raw)
mib@ppe.bb-data.de wrote:
>
> wjjr@sapphire.alisa.org (John J. Rushford) writes:
>
> > sizeof(int) == sizeof(long) is true on a lot of UNIX platforms not just Linux
> > or Solaris x86 and has been for a long time. Just curious as to why you use
> > this criteria to judge which OS to use.
>
> Take another look at the subject. For primary development, use the
> platform that is most unforgiving when it comes to coding errors, and
> port to more lenient platforms. The other way around it is a nightmare (believe
> me--I've been there). Two of the most frequent coding errors in the
> UNIX developer community (precisely because it is, as you say, common
> to have int and long to be identical) is to confuse ints and longs,
> especially when it comes to passing parameters, mixing pointers, and
> *printf formats, and "tunneling" pointer values through int variables
> and arguments. Try porting a 100.000+ lines of code application laced
> with these bugs to Digital Unix *shudder*. If you code for dUNIX
> first, you'll catch these buggers up-front. Plus, you learn to avoid them.
I would respectfully submit that you should not equate your development
environment with your test bed. If you force yourself to develop on
your 'most unforgiving' target environment you may significantly reduce
your productivity. A much better development environment could be
available on another system. Development of portable code is a matter
of discipline. I would agree that your 'most unforgiving' target should
be the first one tested against. If the system passes that test it should
work on less 'unforgiving' systems. Your development environment can and
should keep you from developing non-portable code as defined by your
coding standards regardless of what platform it runs on.
I don't mean to argue against dUNIX or for any other system. Only to
point out that there are tradeoffs to be considered.
--
Chuck Dillon
ced@noran.com
--- Gratuitous waste of bandwidth omitted ---
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-03 4:00 ` Chuck Dillon
@ 1996-09-03 4:00 ` Poll Dubh
1996-09-06 4:00 ` Paul T. Wilson
1 sibling, 0 replies; 56+ messages in thread
From: Poll Dubh @ 1996-09-03 4:00 UTC (permalink / raw)
>mib@ppe.bb-data.de wrote:
>> wjjr@sapphire.alisa.org (John J. Rushford) writes:
>> > sizeof(int) == sizeof(long) is true on a lot of UNIX platforms not just Linux
>> > or Solaris x86 and has been for a long time. Just curious as to why you use
>> > this criteria to judge which OS to use.
>> Take another look at the subject. For primary development, use the
>> platform that is most unforgiving when it comes to coding errors, and
>> port to more lenient platforms. The other way around it is a nightmare (believe
>> me--I've been there). Two of the most frequent coding errors in the
>> UNIX developer community (precisely because it is, as you say, common
>> to have int and long to be identical) is to confuse ints and longs,
>> especially when it comes to passing parameters, mixing pointers, and
>> *printf formats, and "tunneling" pointer values through int variables
>> and arguments. Try porting a 100.000+ lines of code application laced
>> with these bugs to Digital Unix *shudder*. If you code for dUNIX
>> first, you'll catch these buggers up-front. Plus, you learn to avoid them.
A good compiler will warn you about these things. My makefiles tend to have
CC=gcc -ansi -pedantic -Wall -Wtraditional -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes \
-Wmissing-prototypes -Waggregate-return
(and also -fshort-enums, but that's besides the point).
Parameter passing? Anything without a prototype will be flagged.
Prototype mismatches will be flagged. Cases where old K&R C
would implicitly change the passed type are flagged.
Mixing pointers? Will be flagged too, albeit perhaps not quite as
strictly as with IBM's XL compilers for AIX.
*printf formats? Mismatches between int and long int are flagged.
Since gcc runs on many platforms, the only factor left is the quality
of each platform's /usr/include header files. I'm not sure which is most
unforgiving.
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-03 4:00 ` Chuck Dillon
1996-09-03 4:00 ` Poll Dubh
@ 1996-09-06 4:00 ` Paul T. Wilson
1996-09-09 4:00 ` Chuck Dillon
1 sibling, 1 reply; 56+ messages in thread
From: Paul T. Wilson @ 1996-09-06 4:00 UTC (permalink / raw)
In article <322C385A.1AB4@noran.com>, Chuck Dillon <ced@noran.com> wrote:
>mib@ppe.bb-data.de wrote:
>>
>> wjjr@sapphire.alisa.org (John J. Rushford) writes:
>>
>> > sizeof(int) == sizeof(long) is true on a lot of UNIX platforms not
just Linux
>> > or Solaris x86 and has been for a long time. Just curious as to why
you use
>> > this criteria to judge which OS to use.
>>
>> Take another look at the subject. For primary development, use the
>> platform that is most unforgiving when it comes to coding errors, and
>> port to more lenient platforms. The other way around it is a nightmare
(believe
>> me--I've been there). Two of the most frequent coding errors in the
>> UNIX developer community (precisely because it is, as you say, common
>> to have int and long to be identical) is to confuse ints and longs,
>> especially when it comes to passing parameters, mixing pointers, and
>> *printf formats, and "tunneling" pointer values through int variables
>> and arguments. Try porting a 100.000+ lines of code application laced
>> with these bugs to Digital Unix *shudder*. If you code for dUNIX
>> first, you'll catch these buggers up-front. Plus, you learn to avoid them.
>
>I would respectfully submit that you should not equate your development
>environment with your test bed. If you force yourself to develop on
>your 'most unforgiving' target environment you may significantly reduce
>your productivity. A much better development environment could be
>available on another system. Development of portable code is a matter
>of discipline. I would agree that your 'most unforgiving' target should
>be the first one tested against. If the system passes that test it should
>work on less 'unforgiving' systems. Your development environment can and
>should keep you from developing non-portable code as defined by your
>coding standards regardless of what platform it runs on.
>
>I don't mean to argue against dUNIX or for any other system. Only to
>point out that there are tradeoffs to be considered.
My only comment to this Chuck is that in more than 18 years of programming
I've yet to work with a "development environment" by which I assume you
mean some capability that has some level of smarts and helps you create
the program. As a programmer I still need to know that int != long.
Indeed, being familiar with the differences between platforms provides the
necessary heads up if you haven't developed "portable" code. Frankly,
simply because portability was not a requirement much of the code I've
written hasn't been "portable". But, believe it or not, it's been ported.
The discipline necessary to practice correct ("portable") programming is
not, IMHO, instilled by a "development environment". Not that I wouldn't
like to program in one!
--
Paul T. Wilson Programmer Guy (:-)
Look, do you mind if we have an argument here? - Merlo
Do you have enough mind for an argument here? - Marty
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-06 4:00 ` Paul T. Wilson
@ 1996-09-09 4:00 ` Chuck Dillon
0 siblings, 0 replies; 56+ messages in thread
From: Chuck Dillon @ 1996-09-09 4:00 UTC (permalink / raw)
Paul T. Wilson wrote:
>
> My only comment to this Chuck is that in more than 18 years of programming
> I've yet to work with a "development environment" by which I assume you
> mean some capability that has some level of smarts and helps you create
> the program. As a programmer I still need to know that int != long.
> Indeed, being familiar with the differences between platforms provides the
> necessary heads up if you haven't developed "portable" code. Frankly,
> simply because portability was not a requirement much of the code I've
> written hasn't been "portable". But, believe it or not, it's been ported.
I couldn't agree more. In MY 18 years of software development I have
rarely been given a portability requirement and because of that when
the code finally was ported it was not done so as gracefully as it might
have been. But then developing portable code is more expensive than
building to a standard platform so the savings over the lifetime of the
code on the old system may well have paid for the cost of porting it.
But then that may not be so if time to market is taken into account.
>
> The discipline necessary to practice correct ("portable") programming is
> not, IMHO, instilled by a "development environment". Not that I wouldn't
> like to program in one!
Again I agree. Although you have far to grandiose an interpretation of
what I refer to as a development environment. By development environment
I mean the environment in which you develop including the system (hardare
and OS) and the tools (a compiler and editor are tools). What I do not
do is assume that the development environment is the same as the target
environment in which the app must run. For a multi-platform system it
can't be and I would argue it doesn't have to be any of the targets.
I would want the development environment that provides me with the best
tools to do my job regardless of the target. If I am developing a UI
for a VCR I don't want to develop on a VCR.
--
Chuck Dillon
ced@noran.com
--- Gratuitous waste of bandwidth omitted ---
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (4 preceding siblings ...)
1996-09-03 4:00 ` Chuck Dillon
@ 1996-09-03 4:00 ` Martin Knoblauch
1996-09-03 4:00 ` mib
` (5 subsequent siblings)
11 siblings, 0 replies; 56+ messages in thread
From: Martin Knoblauch @ 1996-09-03 4:00 UTC (permalink / raw)
mib@ppe.bb-data.de wrote:
>
> Pawel Wezgowiec <paulw@k2.pcz.czest.pl> writes:
>
> > Is HP-UX that bad platform ??
> >
> > Probably there are more Unix systems with
> > sizeof(int) == sizeof(long). But I don't think it's
> > really important.
>
I would actually say, that most 32-bit OSes will have that
relation. But it is a big mistake to assume that this holds
forever. This implicit assumption is probably the major
hurdle when porting from ILP32 (-32/-n32) to LP64 (-64).
> If you are a very good developer who doesn't make the stupid kind of
> mistakes we mere mortals make (and you don't have any code from mere
> mortals to maintain or incorporate into your code), or if you
> absolutely, positively know that you'll never port your code to a
> platform where ints and longs are really distinct types, then it is
> not important.
>
> But my experience, people do make mistakes like
>
> time_t t;
> sprintf(buf, "%ld", t);
>
> or
>
> long l;
> time(&l);
>
> or
> int foo(long *l);
> int i;
>
> foo(&i);
>
> or
> int foo(int i)
> {
> void *p=(void*)i;
> }
>
> or
>
> ...
>
> Believe me. It does happen (especially legacy code is full of this
> kind of stuff). And if you have to weed these out during a
> port -- nightmare.
Actually, the compilers for n32/64 are pretty good at
showing you how crappy your code is. If you want all the
fun, just turn on "-fullwarn".
Martin
--
+---------------------------------+-----------------------------------+
|Martin Knoblauch | Silicon Graphics GmbH |
|Manager Application Center | Am Hochacker 3 - Technopark |
|Silicon Graphics Computer Systems| D-85630 Grasbrunn-Neukeferloh, FRG|
| | Phone: (+int) 89 46108-179 or -0 |
| | Fax: (+int) 89 46108-190 (-222) |
+---------------------------------+-----------------------------------+
|e-mail: <knobi@munich.sgi.com> | V-Mail: 5-8935 | M/S: IDE-3150 |
+---------------------------------------------------------------------+
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (5 preceding siblings ...)
1996-09-03 4:00 ` Martin Knoblauch
@ 1996-09-03 4:00 ` mib
1996-09-06 4:00 ` Per Schr�der
1996-09-04 4:00 ` Urs Thuermann
` (4 subsequent siblings)
11 siblings, 1 reply; 56+ messages in thread
From: mib @ 1996-09-03 4:00 UTC (permalink / raw)
Pawel Wezgowiec <paulw@k2.pcz.czest.pl> writes:
> Is HP-UX that bad platform ??
>
> Probably there are more Unix systems with
> sizeof(int) == sizeof(long). But I don't think it's
> really important.
If you are a very good developer who doesn't make the stupid kind of
mistakes we mere mortals make (and you don't have any code from mere
mortals to maintain or incorporate into your code), or if you
absolutely, positively know that you'll never port your code to a
platform where ints and longs are really distinct types, then it is
not important.
But my experience, people do make mistakes like
time_t t;
sprintf(buf, "%ld", t);
or
long l;
time(&l);
or
int foo(long *l);
int i;
foo(&i);
or
int foo(int i)
{
void *p=(void*)i;
}
or
...
Believe me. It does happen (especially legacy code is full of this
kind of stuff). And if you have to weed these out during a port -- nightmare.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-03 4:00 ` mib
@ 1996-09-06 4:00 ` Per Schr�der
0 siblings, 0 replies; 56+ messages in thread
From: Per Schr�der @ 1996-09-06 4:00 UTC (permalink / raw)
In article <u7mqcma7d.fsf@ppe.bb-data.de>, mib@ppe.bb-data.de
<kiawwyl8j89.fsf@laforge.ppe.bb-data.de>
<wgalazka.213.841321343@zoolook.chem.uw.edu.pl>
<5050gc$1fc@nntpa.cb.lucent.com> <Dx2Hx7.AFw@sapphire.alisa.org>
<Pine.HPP.3.94.960902140235.15361A-100000@k2.pcz.czest.pl> wrote:
>Pawel Wezgowiec <paulw@k2.pcz.czest.pl> writes:
>
>> Is HP-UX that bad platform ??
>>
>> Probably there are more Unix systems with
>> sizeof(int) == sizeof(long). But I don't think it's
>> really important.
>
>If you are a very good developer who doesn't make the stupid kind of
>mistakes we mere mortals make (and you don't have any code from mere
>mortals to maintain or incorporate into your code), or if you
>absolutely, positively know that you'll never port your code to a
>platform where ints and longs are really distinct types, then it is
>not important.
>
[snip]
Take a look at http://xoweb.xopen.org/public/tech/aspen/lp64_wp.htm
This document describes the programming model to be used for 64-bit
computing. The model preferred was LP64 (sizeof(int) < sizeof(long)).
Some of the companies participating (HP, Sun, etc?) are already using the
LLP64 model (sizeof(int) == sizeof(long) < sizeof(long long)).
So how are HP and Sun going to move to 64-bit computing? Migrating the
existing programking model and porting existing applications? Supporting
two models at once (with two versions of system header files and
difficulties linking libraries compiled with different models)? What?
--
E-mail: per@mimer.se Address: Sysdeco Mimer AB
Phone: (+46) 18 18 51 33 Box 1713
Fax: (+46) 18 18 51 00 S-751 47 Uppsala SWEDEN
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (6 preceding siblings ...)
1996-09-03 4:00 ` mib
@ 1996-09-04 4:00 ` Urs Thuermann
1996-09-05 4:00 ` Peter Gross
1996-09-05 4:00 ` Ronald Fischer
` (3 subsequent siblings)
11 siblings, 1 reply; 56+ messages in thread
From: Urs Thuermann @ 1996-09-04 4:00 UTC (permalink / raw)
In article <u7mqcma7d.fsf@ppe.bb-data.de> mib@ppe.bb-data.de writes:
> But my experience, people do make mistakes like
>
> time_t t;
> sprintf(buf, "%ld", t);
What is the portable way to printf size_t, time_t, and so on values?
On some machines, where int is 16 bit, size_t and time_t will be
typedefed as long so %ld seems right. On most unices they are
typedefed as int.
Is there another portable way than
time_t t;
printf("%ld", (long)t);
urs
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-04 4:00 ` Urs Thuermann
@ 1996-09-05 4:00 ` Peter Gross
0 siblings, 0 replies; 56+ messages in thread
From: Peter Gross @ 1996-09-05 4:00 UTC (permalink / raw)
thuerman@ibr.cs.tu-bs.de (Urs Thuermann) wrote:
>In article <u7mqcma7d.fsf@ppe.bb-data.de> mib@ppe.bb-data.de writes:
>> But my experience, people do make mistakes like
>>
>> time_t t;
>> sprintf(buf, "%ld", t);
>What is the portable way to printf size_t, time_t, and so on values?
>On some machines, where int is 16 bit, size_t and time_t will be
>typedefed as long so %ld seems right. On most unices they are
>typedefed as int.
>Is there another portable way than
> time_t t;
> printf("%ld", (long)t);
The portable way is to use C++ :)
time_t t;
cout << t;
peter gross
pag@probita.com
+1.303.546.6307 x3329
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (7 preceding siblings ...)
1996-09-04 4:00 ` Urs Thuermann
@ 1996-09-05 4:00 ` Ronald Fischer
1996-09-05 4:00 ` mib
` (2 subsequent siblings)
11 siblings, 0 replies; 56+ messages in thread
From: Ronald Fischer @ 1996-09-05 4:00 UTC (permalink / raw)
To: Urs Thuermann
Urs Thuermann wrote:
> What is the portable way to printf size_t, time_t, and so on values?
> On some machines, where int is 16 bit, size_t and time_t will be
> typedefed as long so %ld seems right. On most unices they are
> typedefed as int.
>
> Is there another portable way than
>
> time_t t;
> printf("%ld", (long)t);
What about
printf(sizeof(long)==sizeof(time_t) ? "%ld" : "%d",t)
--
Ronald Otto Valentin Fischer
business: ronald.fischer@uebemc.siemens.de
private: ronald.fischer@acm.org
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (8 preceding siblings ...)
1996-09-05 4:00 ` Ronald Fischer
@ 1996-09-05 4:00 ` mib
1996-09-06 4:00 ` Peter Mayne
1996-09-06 4:00 ` mib
11 siblings, 0 replies; 56+ messages in thread
From: mib @ 1996-09-05 4:00 UTC (permalink / raw)
thuerman@ibr.cs.tu-bs.de (Urs Thuermann) writes:
> Is there another portable way than
>
> time_t t;
> printf("%ld", (long)t);
No. That's the best you can do. I've made a habit of casting printf
arguments every time, unless the type is totally clear. At the very
least, entities of the POSIXy types like pid_t or uid_t must be cast
(casted? Non-native speaker, sorry.) before use as a printf argument.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (9 preceding siblings ...)
1996-09-05 4:00 ` mib
@ 1996-09-06 4:00 ` Peter Mayne
1996-09-06 4:00 ` Eric Fischer
` (2 more replies)
1996-09-06 4:00 ` mib
11 siblings, 3 replies; 56+ messages in thread
From: Peter Mayne @ 1996-09-06 4:00 UTC (permalink / raw)
Ronald Fischer wrote:
>
> Urs Thuermann wrote:
>
> > What is the portable way to printf size_t, time_t, and so on values?
> > On some machines, where int is 16 bit, size_t and time_t will be
> > typedefed as long so %ld seems right. On most unices they are
> > typedefed as int.
> >
> > Is there another portable way than
> >
> > time_t t;
> > printf("%ld", (long)t);
>
> What about
> printf(sizeof(long)==sizeof(time_t) ? "%ld" : "%d",t)
Who said time_t is a scalar? It might be something else, mightn't it?
Use ctime(3) or locatime(3) and print the results.
--
PJDM
Digital Equipment Corporation (Australia), Canberra, ACT
-------------------------------------------------------------------------------
These are my opinions, and have nothing to do with Digital.
I design Internet Service Providers. It's a job.
.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-06 4:00 ` Peter Mayne
@ 1996-09-06 4:00 ` Eric Fischer
1996-09-09 4:00 ` Dan Pop
1996-09-13 4:00 ` David Mosberger-Tang
2 siblings, 0 replies; 56+ messages in thread
From: Eric Fischer @ 1996-09-06 4:00 UTC (permalink / raw)
Peter Mayne <Peter.Mayne@cao.mts.dec.com> wrote:
> Who said time_t is a scalar? It might be something else, mightn't it?
ANSI C says it's a numeric type, though you're not supposed to do any
arithmetic on it at all, which probably makes printing it a bad idea
too. POSIX actually says it's the number of seconds since January 1st,
1970, and I think even says that it'll be either a long or a double.
Eric
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-06 4:00 ` Peter Mayne
1996-09-06 4:00 ` Eric Fischer
@ 1996-09-09 4:00 ` Dan Pop
1996-09-11 4:00 ` Richard Tobin
1996-09-13 4:00 ` David Mosberger-Tang
2 siblings, 1 reply; 56+ messages in thread
From: Dan Pop @ 1996-09-09 4:00 UTC (permalink / raw)
In <322F54A6.44FE@cao.mts.dec.com> Peter Mayne <Peter.Mayne@cao.mts.dec.com> writes:
>Who said time_t is a scalar?
ANSI/ISO C. But it doesn't say what kind of scalar:
The types declared are size_t (described in $4.1.5);
clock_t
and
time_t
which are arithmetic types capable of representing times;
^^^^^^^^^^^^^^^^
So, it can be any of the 9 integral types or 3 floating point types.
>It might be something else, mightn't it?
Nope. All the standard library functions returning a time_t value
return (time_t)-1 in case of failure.
Within the frame of ANSI C, printing a time_t value is pointless,
because the way the time is encoded is unspecified.
Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@cern.ch
Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-09 4:00 ` Dan Pop
@ 1996-09-11 4:00 ` Richard Tobin
1996-09-12 4:00 ` Lawrence Kirby
1996-09-13 4:00 ` Marc Roussel
0 siblings, 2 replies; 56+ messages in thread
From: Richard Tobin @ 1996-09-11 4:00 UTC (permalink / raw)
In article <danpop.842229249@news.cern.ch> Dan.Pop@cern.ch (Dan Pop) writes:
>Within the frame of ANSI C, printing a time_t value is pointless,
>because the way the time is encoded is unspecified.
You might want to read it in again later.
> it can be any of the 9 integral types or 3 floating point types.
There might be some trick for portably determining whether it's an
integral or floating type. How about
(time_t)0.3 == 0
Am I right in thinking this expression is always legal and must be
true iff time_t is an integral type?
-- Richard
--
:wq
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-11 4:00 ` Richard Tobin
@ 1996-09-12 4:00 ` Lawrence Kirby
1996-09-13 4:00 ` Dan Pop
1996-09-13 4:00 ` Marc Roussel
1 sibling, 1 reply; 56+ messages in thread
From: Lawrence Kirby @ 1996-09-12 4:00 UTC (permalink / raw)
In article <DxKEKD.B04@cogsci.ed.ac.uk>
richard@cogsci.ed.ac.uk "Richard Tobin" writes:
>In article <danpop.842229249@news.cern.ch> Dan.Pop@cern.ch (Dan Pop) writes:
>
>>Within the frame of ANSI C, printing a time_t value is pointless,
>>because the way the time is encoded is unspecified.
>
>You might want to read it in again later.
In that case just print it as:
printf("%Lf", (long double)t);
This is generally of more interest for clock_t values.
>> it can be any of the 9 integral types or 3 floating point types.
>
>There might be some trick for portably determining whether it's an
>integral or floating type. How about
>
> (time_t)0.3 == 0
That looks OK but I can't think of any situation where it would be
particularly useful.
size_t values should be cast to unsigned long, ptrdiff_t values to long.
Integral constants (EOF, BUFSIZ) can usually be categorised by whether
they can be negative or not and by usage i.e. the type of arguments/return
values that they can be passed through.
>Am I right in thinking this expression is always legal and must be
>true iff time_t is an integral type?
Yes.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-12 4:00 ` Lawrence Kirby
@ 1996-09-13 4:00 ` Dan Pop
1996-09-15 4:00 ` Lawrence Kirby
0 siblings, 1 reply; 56+ messages in thread
From: Dan Pop @ 1996-09-13 4:00 UTC (permalink / raw)
In <842570087snz@genesis.demon.co.uk> fred@genesis.demon.co.uk (Lawrence Kirby) writes:
>In article <DxKEKD.B04@cogsci.ed.ac.uk>
> richard@cogsci.ed.ac.uk "Richard Tobin" writes:
>
>>In article <danpop.842229249@news.cern.ch> Dan.Pop@cern.ch (Dan Pop) writes:
>>
>>>Within the frame of ANSI C, printing a time_t value is pointless,
>>>because the way the time is encoded is unspecified.
>>
>>You might want to read it in again later.
>
>In that case just print it as:
>
> printf("%Lf", (long double)t);
But you may lose bits of precision if the bits of the time_t value don't
fit in the mantissa of a long double.
Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@cern.ch
Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-13 4:00 ` Dan Pop
@ 1996-09-15 4:00 ` Lawrence Kirby
0 siblings, 0 replies; 56+ messages in thread
From: Lawrence Kirby @ 1996-09-15 4:00 UTC (permalink / raw)
In article <danpop.842645393@news.cern.ch> Dan.Pop@cern.ch "Dan Pop" writes:
>In <842570087snz@genesis.demon.co.uk> fred@genesis.demon.co.uk (Lawrence Kirby)
> writes:
>
>>In article <DxKEKD.B04@cogsci.ed.ac.uk>
>> richard@cogsci.ed.ac.uk "Richard Tobin" writes:
>>
>>>In article <danpop.842229249@news.cern.ch> Dan.Pop@cern.ch (Dan Pop) writes:
>>>
>>>>Within the frame of ANSI C, printing a time_t value is pointless,
>>>>because the way the time is encoded is unspecified.
>>>
>>>You might want to read it in again later.
>>
>>In that case just print it as:
>>
>> printf("%Lf", (long double)t);
>
>But you may lose bits of precision if the bits of the time_t value don't
>fit in the mantissa of a long double.
OTOH double may well be considered enough since that is the limit of
the precision of difftime(). OK, there's no perfect solution however
double/long double will work on any reasonable implementation and even
where it isn't exact it is only likely to be inexact to a vary small
fraction of a second. There's a problem even when time_t is known to
be integral since there's no guarantee that you can uniquely map
all the values of long to unsigned long (or vice versa). So for the
ultimate belts-and-braces solution one you'd determined it was integral
you'd also need to test whether time_t is a signed or unsigned integral
type.
I'm still happy with long double.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-11 4:00 ` Richard Tobin
1996-09-12 4:00 ` Lawrence Kirby
@ 1996-09-13 4:00 ` Marc Roussel
1 sibling, 0 replies; 56+ messages in thread
From: Marc Roussel @ 1996-09-13 4:00 UTC (permalink / raw)
Richard Tobin wrote:
> In article <danpop.842229249@news.cern.ch> Dan.Pop@cern.ch (Dan Pop)
> writes:
> > it [time_t] can be any of the 9 integral types or 3 floating point
> > types.
>
> There might be some trick for portably determining whether it's an
> integral or floating type. How about
>
> (time_t)0.3 == 0
>
> Am I right in thinking this expression is always legal and must be
> true iff time_t is an integral type?
Why would you ever want to do that? You might thereby figure out
whether time_t is an integral or floating point type, but you still
can't do much directly with time_t values. That's why there are
standard library functions for handling them and converting them to and
from more useful formats.
If you try to use tricks like these, one of three things is likely
to happen:
1. Your code is perfectly portable and equally unreadable.
2. Your code should be portable but some compiler and library
writers with less legalistic minds than yours have
interpreted the standard in a sloppy way so your
code isn't really portable.
3. You have overinterpreted the standard and your code only
works as intended on a small number of machines.
This kind of fun you don't need.
Marc R. Roussel
(roussel@henri.chem.uleth.ca)
Department of Chemistry
University of Lethbridge
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-09-06 4:00 ` Peter Mayne
1996-09-06 4:00 ` Eric Fischer
1996-09-09 4:00 ` Dan Pop
@ 1996-09-13 4:00 ` David Mosberger-Tang
2 siblings, 0 replies; 56+ messages in thread
From: David Mosberger-Tang @ 1996-09-13 4:00 UTC (permalink / raw)
fred@genesis.demon.co.uk (Lawrence Kirby) writes:
> In article <DxKEKD.B04@cogsci.ed.ac.uk>
> richard@cogsci.ed.ac.uk "Richard Tobin" writes:
>
> >In article <danpop.842229249@news.cern.ch> Dan.Pop@cern.ch (Dan Pop) writes:
> >
> >>Within the frame of ANSI C, printing a time_t value is pointless,
> >>because the way the time is encoded is unspecified.
> >
> >You might want to read it in again later.
>
> In that case just print it as:
>
> printf("%Lf", (long double)t);
No, this would lose precision on some platforms (e.g., Linux on Alpha
has sizeof(time_t)==sizeof(long double)==8).
--david
--
David Mosberger-Tang; Dept. of CS; The University of Arizona; Tucson, AZ 85721
davidm@cs.arizona.edu http://www.cs.arizona.edu/people/davidm
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: best UNIX OS as primary platform for UNIX system software develpoment?
1996-08-19 4:00 ` Matt Houseman x4408
` (10 preceding siblings ...)
1996-09-06 4:00 ` Peter Mayne
@ 1996-09-06 4:00 ` mib
11 siblings, 0 replies; 56+ messages in thread
From: mib @ 1996-09-06 4:00 UTC (permalink / raw)
Ronald Fischer <ronald.fischer@uebemc.siemens.de> writes:
> What about
> printf(sizeof(long)==sizeof(time_t) ? "%ld" : "%d",t)
Is there any guarantee that time_t is either long or int? I doubt it.
^ permalink raw reply [flat|nested] 56+ messages in thread