Empty struct in C

Empty struct in C is undefined behaviour (refer C17 spec, section 6.7.2.1):

If the struct-declaration-list does not contain any named members, either directly or via an anonymous structure or anonymous union, the behavior is undefined.

On my Linux, I use both gcc (v9.1.0) and clang (v8.0.0) to compile following code:

$ cat test.c
#include <stdio.h>

typedef struct A {} A;

int main()
{
    printf("%zu\n", sizeof(A));
}

No warnings, and both ouput:
0

Reference:
C empty struct — what does this mean/do?.

Configure uncrustify in Visual Studio Code

Visual Studio Code already has uncrustify extension:

After installing it, you can modify the uncrustify‘s configuration file path. On macOS: Code -> Preferences -> Settings-> Extensions -> Uncrusify configuration -> Configure Path: Osx:

Then edit settings.json:

{
    ......
    "uncrustify.configPath.osx": "/Users/nanxiao/Documents/uncrustify.cfg",
} 

Now you can format your code through “Option + shift + F” command.(You should disable C/C++ extension‘s formatting function, please refer troubleshooting . Update in 2023: for currentVisual Studio Code, it will prompt you select uncrustify or other extensions as the format tool)

BTW, you can enable formatting code when saving file function:

{
    ......
    "editor.formatOnSave": true,
}