1 ?RCS: $Id: intsize.U,v 3.0.1.2 1997/02/28 15:55:26 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: intsize.U,v $
12 ?RCS: Revision 3.0.1.2 1997/02/28 15:55:26 ram
13 ?RCS: patch61: avoid prompting the user if the test runs ok
14 ?RCS: patch61: moved code from longsize.U into there
15 ?RCS: patch61: new tests for shortsize as well
17 ?RCS: Revision 3.0.1.1 1994/10/29 16:21:06 ram
18 ?RCS: patch36: added ?F: line for metalint file checking
20 ?RCS: Revision 3.0 1993/08/18 12:08:52 ram
21 ?RCS: Baseline for dist 3.0 netwide release.
23 ?MAKE:intsize longsize shortsize: Compile Myread cat run i_stdlib rm_try
24 ?MAKE: -pick add $@ %<
26 ?S: This variable contains the value of the INTSIZE symbol, which
27 ?S: indicates to the C program how many bytes there are in an int.
30 ?S: This variable contains the value of the LONGSIZE symbol, which
31 ?S: indicates to the C program how many bytes there are in a long.
34 ?S: This variable contains the value of the SHORTSIZE symbol which
35 ?S: indicates to the C program how many bytes there are in a short.
38 ?C: This symbol contains the value of sizeof(int) so that the C
39 ?C: preprocessor can make decisions based on it.
42 ?C: This symbol contains the value of sizeof(long) so that the C
43 ?C: preprocessor can make decisions based on it.
46 ?C: This symbol contains the value of sizeof(short) so that the C
47 ?C: preprocessor can make decisions based on it.
49 ?H:#define INTSIZE $intsize /**/
50 ?H:#define LONGSIZE $longsize /**/
51 ?H:#define SHORTSIZE $shortsize /**/
53 : check for lengths of integral types
57 echo "Checking to see how big your integers are..." >&4
66 @if INTSIZE || intsize
67 printf("intsize=%d;\n", (int)sizeof(int));
69 @if LONGSIZE || longsize
70 printf("longsize=%d;\n", (int)sizeof(long));
72 @if SHORTSIZE || shortsize
73 printf("shortsize=%d;\n", (int)sizeof(short));
79 if eval $compile_ok && $run ./try > /dev/null; then
81 @if INTSIZE || intsize
82 echo "Your integers are $intsize bytes long."
84 @if LONGSIZE || longsize
85 echo "Your long integers are $longsize bytes long."
87 @if SHORTSIZE || shortsize
88 echo "Your short integers are $shortsize bytes long."
93 Help! I can't compile and run the intsize test program: please enlighten me!
94 (This is probably a misconfiguration in your system or libraries, and
95 you really ought to fix it. Still, I'll try anyway.)
98 @if INTSIZE || intsize
100 rp="What is the size of an integer (in bytes)?"
104 @if LONGSIZE || longsize
106 rp="What is the size of a long integer (in bytes)?"
110 @if SHORTSIZE || shortsize
112 rp="What is the size of a short integer (in bytes)?"