Search notes:

gcc -fshort-wchar

The -fshort-wchar option specifies that the underlying type for a wchar_t should be short unsigned int.
The following program prints the size of a wchar_t:
#include <stdio.h>
#include <stddef.h>

int main() {

  printf("sizeof(wchar_t): %d\n", sizeof(wchar_t));

}
Github repository about-gcc, path: /options/f/short/wchar/prog.c
This Makefile creates two versions of the program, one of which is compiled with the -fshort-wchar options.
#
#  Create two versions of the program, one thati
#  is compiled with and another that is compiled
#  without the -fshort-wchar option:
#
all: a.out short-wchar

a.out: prog.c
	gcc $< -o $@

short-wchar: prog.c
	gcc -fshort-wchar $< -o $@
Github repository about-gcc, path: /options/f/short/wchar/Makefile
On platforms, where the size of a wchar_t is four bytes, the version where the option is used, the size is reduced to two bytes.

See also

GCC options

Index