cc really dumps core on this program. why?

cliff bedore cliffb at cjbsys.bdb.com
Thu Aug 30 10:27:05 AEST 1990


In article <13116 at hydra.gatech.EDU> gt0178a at prism.gatech.EDU (BURNS,JIM) writes:
>in article <1990Aug28.041601.5515 at d.cs.okstate.edu>, klarich at d.cs.okstate.edu (KLARICH TERRY JAME) says:
>< #include <stdio.h>
>< #include <values.h>
>< 
>< struct {
><  double min,max;
>< } range = {MINDOUBLE,MAXDOUBLE};
>< 
>< main()
>< {
>< printf("range.min = %E, range.max = %E\n",range.min,range.max);
>< }
>< --------------------------------------------------------------------------------
>< This program causes the cc compiler to dump core.  I am using Xenix 2.3.2
>< with the lng085 update.
>
>Just as a point of interest, this compiles and executes fine on HP-UX 7.0,
>SunOS 4.0.3, and Ultrix 2.2. However, it gets the compile error 'illegal
>initialization' under A/UX 1.1, or the ATT universe on Dynix 2.0v2.
>
>-- 
>BURNS,JIM
>Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
>uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
>Internet: gt0178a at prism.gatech.edu

OK I couldn't take it any more so I started playing.  It appears that the value
for MINDOUBLE is wrong in values.h.  I played around and the program below works
e-321 appears to be as small as you can go



#include <stdio.h>
#include <values.h>

struct {
 double min,max;
} range = {4.940656e-321,1.797693e+308,};
/* } range = {MINDOUBLE,MAXDOUBLE};
*/ 
main()
{
printf("range.min = %E, range.max = %E\n",range.min,range.max);
/* printf("range.min = %E, range.max = %E\n",range.min,range.max);
*/
}



More information about the Comp.unix.xenix.sco mailing list