28240bc5f0c103b9bf8e90637e6c5464bca55dc7 hiram Mon Mar 2 13:14:45 2020 -0800 correct one line header message in usage() refs #25071 diff --git src/utils/sizeof/sizeof.c src/utils/sizeof/sizeof.c index f44cff5..c000352 100644 --- src/utils/sizeof/sizeof.c +++ src/utils/sizeof/sizeof.c @@ -1,51 +1,53 @@ /* * sizeof - show size of various C types for reference * $Id: sizeof.c,v 1.3 2005/12/02 19:21:42 hiram Exp $ */ /* Copyright (C) 2011 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include <stdio.h> int main() { unsigned int byteOrder = 0x12345678; unsigned char *cp = (unsigned char *) &byteOrder; +printf("sizeof - show size of various C types for reference\n\n"); + printf(" type bytes bits\n"); printf(" char\t%d\t%d\n", (int)sizeof(char), 8*(int)sizeof(char)); printf("unsigned char\t%d\t%d\n", (int)sizeof(unsigned char), 8*(int)sizeof(unsigned char)); printf("short int\t%d\t%d\n", (int)sizeof(short int), 8*(int)sizeof(short int)); printf("u short int\t%d\t%d\n", (int)sizeof(unsigned short int), 8*(int)sizeof(unsigned short int)); printf(" int\t%d\t%d\n", (int)sizeof(int), 8*(int)sizeof(int)); printf(" unsigned\t%d\t%d\n", (int)sizeof(unsigned), 8*(int)sizeof(unsigned)); printf(" long\t%d\t%d\n", (int)sizeof(long), 8*(int)sizeof(long)); printf("unsigned long\t%d\t%d\n", (int)sizeof(unsigned long), 8*(int)sizeof(unsigned long)); printf("long long\t%d\t%d\n", (int)sizeof(long long), 8*(int)sizeof(long long)); printf("u long long\t%d\t%d\n", (int)sizeof(unsigned long long), 8*(int)sizeof(unsigned long long)); printf(" size_t\t%d\t%d\n", (int)sizeof(size_t), 8*(int)sizeof(size_t)); printf(" void *\t%d\t%d\n", (int)sizeof(void *), 8*(int)sizeof(void *)); printf(" float\t%d\t%d\n", (int)sizeof(float), 8*(int)sizeof(float)); printf(" double\t%d\t%d\n", (int)sizeof(double), 8*(int)sizeof(double)); printf("long double\t%d\t%d\n", (int)sizeof(long double), 8*(int)sizeof(long double)); if (*cp == (char) 0x12) printf ("BIG ENDIAN machine detected\n"); else if (*cp == (char) 0x78) printf ("LITTLE ENDIAN machine detected\n"); else printf ("WARNING: can not determine BIG or LITTLE ENDIAN machine\n"); printf("byte order: normal order: 0x12345678 in memory: 0x"); int i; for (i = 0; i < sizeof(byteOrder); ++i) { printf("%02x", *cp); ++cp; } printf("\n"); return(0); }