3 ms·
tl;dr The use of magic numbers in Linux kernel code is declining. Magic numbers are specific constant values placed within a structure to identify the type of
by isaacfrond 4y ago
tl;dr
The use of magic numbers in Linux kernel code is declining. Magic numbers are specific constant values placed within a structure to identify the type of that structure. In-kernel debugging code can check the magic number and raise an alarm if the expected value is not found, thus detecting problems related to type confusion or data corruption. Magic numbers were originally used in the filesystem code to identify the superblock in the disk image, but later grew in use in other areas of the kernel. However, in recent years their use has declined and this patch set from Ahelenia Ziemiańska may be an indication that the reign of magic numbers may be coming to an end.
- deleted 4y ago[deleted]