[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 32/36] HACKING: Document 'struct' keyword usage
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 32/36] HACKING: Document 'struct' keyword usage |
Date: |
Tue, 20 Aug 2019 08:59:51 +0200 |
From: Eduardo Habkost <address@hidden>
Sometimes we use the 'struct' keyword in headers to help us
reduce dependencies between header files. Document that
practice.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
HACKING | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/HACKING b/HACKING
index 0fc3e0f..097d482 100644
--- a/HACKING
+++ b/HACKING
@@ -100,7 +100,19 @@ pointer, you're guaranteed that it is used to modify the
storage
it points to, or it is aliased to another pointer that is.
2.3. Typedefs
-Typedefs are used to eliminate the redundant 'struct' keyword.
+
+Typedefs are used to eliminate the redundant 'struct' keyword, since type
+names have a different style than other identifiers ("CamelCase" versus
+"snake_case"). Each named struct type should have a CamelCase name and a
+corresponding typedef.
+
+Since certain C compilers choke on duplicated typedefs, you should avoid
+them and declare a typedef only in one header file. For common types,
+you can use "include/qemu/typedefs.h" for example. However, as a matter
+of convenience it is also perfectly fine to use forward struct
+definitions instead of typedefs in headers and function prototypes; this
+avoids problems with duplicated typedefs and reduces the need to include
+headers from other headers.
2.4. Reserved namespaces in C and POSIX
Underscore capital, double underscore, and underscore 't' suffixes should be
--
1.8.3.1
- [Qemu-devel] [PULL 14/36] target/i386: Return 'indefinite integer value' for invalid SSE fp->int conversions, (continued)
- [Qemu-devel] [PULL 14/36] target/i386: Return 'indefinite integer value' for invalid SSE fp->int conversions, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 19/36] timer: last, remove last bits of last, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 20/36] kconfig: do not select VMMOUSE, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 18/36] replay: Remove host_clock_last, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 25/36] replay: refine replay-time module, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 29/36] cpus-common: nuke finish_safe_work, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 27/36] icount: clean up cpu_can_io at the entry to the block, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 36/36] x86: Intel AVX512_BF16 feature enabling, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 28/36] icount: remove unnecessary gen_io_end calls, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 26/36] replay: rename step-related variables and functions, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 32/36] HACKING: Document 'struct' keyword usage,
Paolo Bonzini <=
- [Qemu-devel] [PULL 23/36] util/qemu-timer: refactor deadline calculation for external timers, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 33/36] migration: do not rom_reset() during incoming migration, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 34/36] test-bitmap: test set 1 bit case for bitmap_set, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 35/36] scsi: lsi: exit infinite loop while executing script (CVE-2019-12068), Paolo Bonzini, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, no-reply, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, Peter Maydell, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, no-reply, 2019/08/20