Judy array is an associative array whose key/value are both Word_t
type, and should be the machine word size. This page gives a quite clear explanation of how to use Judy array
, but the example code can’t be used out of box. I modify it and you can download it here if you are interested.
Month: July 2019
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?.
Install VoidLinux
Installing VoidLinux is quite straightforward except during partition. For me, I have only one disk, and don’t want to spend much time on it. So I just select dos
mode, and bootable
for the disk. Then mount it on /
directory, then it is OK.
Reference:
Quick and Reliable Void Linux Installation.
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,
}
Install specified version of sphinx
According to your requirement, you may need to install different versions of sphinx, take installing v1.7.0
as an example:
$ git clone https://github.com/sphinx-doc/sphinx.git
$ cd sphinx
$ git checkout tags/v1.7.0
$ sudo pip install .