Authors: Jay Ghiron
Date: 2026-11-27
Submitted against: C23
Status: Open
In every translation unit, there must be at least one declaration:
translation-unit:
external-declaration
translation-unit external-declaration
However, it is unclear how this interacts with standard headers and standard pragmas which can both expand to declarations. For all following questions, assume that the implementation supports all included headers.
#include<stdalign.h>
Can this be an invalid translation unit? This is the only header that provides absolutely nothing.
/* __STDC_WANT_LIB_EXT1__ is undefined */
#include<assert.h>
#include<errno.h>
#include<float.h>
#include<iso646.h>
#include<limits.h>
#include<stdalign.h>
#include<stdbool.h>
#include<stdckdint.h>
#include<stdnoreturn.h>
Can this be an invalid translation unit? These headers are the only headers that provide no type definitions and no function declarations.
#include<assert.h>
#include<errno.h>
#include<float.h>
#include<iso646.h>
#include<limits.h>
#include<stdalign.h>
#include<stdarg.h>
#include<stdbool.h>
#include<stdckdint.h>
#include<stddef.h>
#include<stdint.h>
#include<stdnoreturn.h>
Can this be an invalid translation unit? These headers are the only headers that provide no function declarations.
#include<assert.h>
#include<ctype.h>
#include<errno.h>
#include<fenv.h>
#include<float.h>
#include<inttypes.h>
#include<iso646.h>
#include<limits.h>
#include<locale.h>
#include<setjmp.h>
#include<signal.h>
#include<stdalign.h>
#include<stdarg.h>
#include<stdatomic.h>
#include<stdbit.h>
#include<stdbool.h>
#include<stdckdint.h>
#include<stddef.h>
#include<stdio.h>
#include<stdlib.h>
#include<stdnoreturn.h>
#include<string.h>
#include<tgmath.h>
#include<threads.h>
#include<uchar.h>
#include<wchar.h>
#include<wctype.h>
Can this be an invalid translation unit? These are all of the headers
that do not get included by other headers. The omitted headers are
<complex.h> and <math.h> which are included by <tgmath.h>,
<stdint.h> which is included by <inttypes.h>, and <time.h> which
is included by <threads.h>.
#pragma STDC FP_CONTRACT ON
#pragma STDC FP_CONTRACT OFF
#pragma STDC FP_CONTRACT DEFAULT
#pragma STDC FENV_ACCESS ON
#pragma STDC FENV_ACCESS OFF
#pragma STDC FENV_ACCESS DEFAULT
#pragma STDC CX_LIMITED_RANGE ON
#pragma STDC CX_LIMITED_RANGE OFF
#pragma STDC CX_LIMITED_RANGE DEFAULT
#pragma STDC FENV_ROUND FE_DOWNWARD
#pragma STDC FENV_ROUND FE_TONEAREST
#pragma STDC FENV_ROUND FE_TONEARESTFROMZERO
#pragma STDC FENV_ROUND FE_TOWARDZERO
#pragma STDC FENV_ROUND FE_UPWARD
#pragma STDC FENV_ROUND FE_DYNAMIC
#ifdef __STDC_IEC_60559_DFP__
#pragma STDC FENV_DEC_ROUND FE_DEC_DOWNWARD
#pragma STDC FENV_DEC_ROUND FE_DEC_TONEAREST
#pragma STDC FENV_DEC_ROUND FE_DEC_TONEARESTFROMZERO
#pragma STDC FENV_DEC_ROUND FE_DEC_TOWARDZERO
#pragma STDC FENV_DEC_ROUND FE_DEC_UPWARD
#pragma STDC FENV_DEC_ROUND FE_DEC_DYNAMIC
#endif
Can this be an invalid translation unit? These are all possible standard pragmas that can be used.