* [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
@ 2011-08-08 12:56 Avi Kivity
2011-08-08 13:00 ` Anthony Liguori
2011-08-08 13:19 ` Peter Maydell
0 siblings, 2 replies; 9+ messages in thread
From: Avi Kivity @ 2011-08-08 12:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kvm
QEMU deals with a lot of fixed width integer types; their names
(uint64_t etc) are clumsy to use and take up a lot of space.
Following Linux, introduce shorter names, for example U64 for
uint64_t.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
qemu-common.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/qemu-common.h b/qemu-common.h
index 0fdecf1..52a2300 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -112,6 +112,15 @@ static inline char *realpath(const char *path, char *resolved_path)
int qemu_main(int argc, char **argv, char **envp);
#endif
+typedef int8_t S8;
+typedef uint8_t U8;
+typedef int16_t S16;
+typedef uint16_t U16;
+typedef int32_t S32;
+typedef uint32_t U32;
+typedef int64_t S64;
+typedef uint64_t U64;
+
/* bottom halves */
typedef void QEMUBHFunc(void *opaque);
--
1.7.5.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 12:56 [Qemu-devel] [PATCH] Introduce short names for fixed width integer types Avi Kivity
@ 2011-08-08 13:00 ` Anthony Liguori
2011-08-08 13:12 ` Avi Kivity
2011-08-08 14:17 ` Kevin Wolf
2011-08-08 13:19 ` Peter Maydell
1 sibling, 2 replies; 9+ messages in thread
From: Anthony Liguori @ 2011-08-08 13:00 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel, kvm
On 08/08/2011 07:56 AM, Avi Kivity wrote:
> QEMU deals with a lot of fixed width integer types; their names
> (uint64_t etc) are clumsy to use and take up a lot of space.
>
> Following Linux, introduce shorter names, for example U64 for
> uint64_t.
Except Linux uses lower case letters.
I personally think Linux style is wrong here. The int8_t types are
standard types.
Besides, we save lots of characters by using 4-space tabs instead of
8-space tabs. We can afford to spend some of those saved characters on
using proper type names :-)
Regards,
Anthony Liguori
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
> qemu-common.h | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-common.h b/qemu-common.h
> index 0fdecf1..52a2300 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -112,6 +112,15 @@ static inline char *realpath(const char *path, char *resolved_path)
> int qemu_main(int argc, char **argv, char **envp);
> #endif
>
> +typedef int8_t S8;
> +typedef uint8_t U8;
> +typedef int16_t S16;
> +typedef uint16_t U16;
> +typedef int32_t S32;
> +typedef uint32_t U32;
> +typedef int64_t S64;
> +typedef uint64_t U64;
> +
> /* bottom halves */
> typedef void QEMUBHFunc(void *opaque);
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 13:00 ` Anthony Liguori
@ 2011-08-08 13:12 ` Avi Kivity
2011-08-08 13:17 ` Anthony Liguori
2011-08-08 14:17 ` Kevin Wolf
1 sibling, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2011-08-08 13:12 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel, kvm
On 08/08/2011 04:00 PM, Anthony Liguori wrote:
> On 08/08/2011 07:56 AM, Avi Kivity wrote:
>> QEMU deals with a lot of fixed width integer types; their names
>> (uint64_t etc) are clumsy to use and take up a lot of space.
>>
>> Following Linux, introduce shorter names, for example U64 for
>> uint64_t.
>
> Except Linux uses lower case letters.
>
> I personally think Linux style is wrong here. The int8_t types are
> standard types.
>
> Besides, we save lots of characters by using 4-space tabs instead of
> 8-space tabs. We can afford to spend some of those saved characters
> on using proper type names :-)
>
It's not about saving space, it's about improving readability. We have
about 21k uses of these types, they deserve short names.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 13:12 ` Avi Kivity
@ 2011-08-08 13:17 ` Anthony Liguori
2011-08-08 13:19 ` Avi Kivity
0 siblings, 1 reply; 9+ messages in thread
From: Anthony Liguori @ 2011-08-08 13:17 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel, kvm
On 08/08/2011 08:12 AM, Avi Kivity wrote:
> On 08/08/2011 04:00 PM, Anthony Liguori wrote:
>> On 08/08/2011 07:56 AM, Avi Kivity wrote:
>>> QEMU deals with a lot of fixed width integer types; their names
>>> (uint64_t etc) are clumsy to use and take up a lot of space.
>>>
>>> Following Linux, introduce shorter names, for example U64 for
>>> uint64_t.
>>
>> Except Linux uses lower case letters.
>>
>> I personally think Linux style is wrong here. The int8_t types are
>> standard types.
>>
>> Besides, we save lots of characters by using 4-space tabs instead of
>> 8-space tabs. We can afford to spend some of those saved characters on
>> using proper type names :-)
>>
>
> It's not about saving space, it's about improving readability. We have
> about 21k uses of these types, they deserve short names.
This is one of the few areas that we're actually consistent with today.
Introducing a new set of types will just create inconsistency.
Most importantly, these are standard types. Every modern library and C
program should be using them. TBH, having short names is just a bad
case of NIH.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 12:56 [Qemu-devel] [PATCH] Introduce short names for fixed width integer types Avi Kivity
2011-08-08 13:00 ` Anthony Liguori
@ 2011-08-08 13:19 ` Peter Maydell
2011-08-09 10:18 ` malc
2011-08-09 12:39 ` Juan Quintela
1 sibling, 2 replies; 9+ messages in thread
From: Peter Maydell @ 2011-08-08 13:19 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel, kvm
On 8 August 2011 13:56, Avi Kivity <avi@redhat.com> wrote:
> QEMU deals with a lot of fixed width integer types; their names
> (uint64_t etc) are clumsy to use and take up a lot of space.
>
> Following Linux, introduce shorter names, for example U64 for
> uint64_t.
Strongly disagree. uint64_t &c are standard types and it's
immediately clear to a competent C programmer what they are.
Random qemu-specific funny named types just introduces an
unnecessary level of indirection.
We only just recently managed to get rid of the nonstandard
typenames for these from fpu/...
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 13:17 ` Anthony Liguori
@ 2011-08-08 13:19 ` Avi Kivity
0 siblings, 0 replies; 9+ messages in thread
From: Avi Kivity @ 2011-08-08 13:19 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel, kvm
On 08/08/2011 04:17 PM, Anthony Liguori wrote:
>
> This is one of the few areas that we're actually consistent with
> today. Introducing a new set of types will just create inconsistency.
>
> Most importantly, these are standard types. Every modern library and
> C program should be using them. TBH, having short names is just a bad
> case of NIH.
>
Those are exactly the same types, compatible with all the libraries.
NIH would be redefining them ourselves (and breaking pointer
compatibility etc.)
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 13:00 ` Anthony Liguori
2011-08-08 13:12 ` Avi Kivity
@ 2011-08-08 14:17 ` Kevin Wolf
1 sibling, 0 replies; 9+ messages in thread
From: Kevin Wolf @ 2011-08-08 14:17 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Avi Kivity, kvm, qemu-devel
Am 08.08.2011 15:00, schrieb Anthony Liguori:
> On 08/08/2011 07:56 AM, Avi Kivity wrote:
>> QEMU deals with a lot of fixed width integer types; their names
>> (uint64_t etc) are clumsy to use and take up a lot of space.
>>
>> Following Linux, introduce shorter names, for example U64 for
>> uint64_t.
>
> Except Linux uses lower case letters.
>
> I personally think Linux style is wrong here. The int8_t types are
> standard types.
I fully agree, we should use the standard types.
> Besides, we save lots of characters by using 4-space tabs instead of
> 8-space tabs. We can afford to spend some of those saved characters on
> using proper type names :-)
Heh, I like this reasoning. :-)
Kevin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 13:19 ` Peter Maydell
@ 2011-08-09 10:18 ` malc
2011-08-09 12:39 ` Juan Quintela
1 sibling, 0 replies; 9+ messages in thread
From: malc @ 2011-08-09 10:18 UTC (permalink / raw)
To: Peter Maydell; +Cc: Avi Kivity, kvm, qemu-devel
On Mon, 8 Aug 2011, Peter Maydell wrote:
> On 8 August 2011 13:56, Avi Kivity <avi@redhat.com> wrote:
> > QEMU deals with a lot of fixed width integer types; their names
> > (uint64_t etc) are clumsy to use and take up a lot of space.
> >
> > Following Linux, introduce shorter names, for example U64 for
> > uint64_t.
>
> Strongly disagree. uint64_t &c are standard types and it's
> immediately clear to a competent C programmer what they are.
> Random qemu-specific funny named types just introduces an
> unnecessary level of indirection.
>
> We only just recently managed to get rid of the nonstandard
> typenames for these from fpu/...
>
Seconded.
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce short names for fixed width integer types
2011-08-08 13:19 ` Peter Maydell
2011-08-09 10:18 ` malc
@ 2011-08-09 12:39 ` Juan Quintela
1 sibling, 0 replies; 9+ messages in thread
From: Juan Quintela @ 2011-08-09 12:39 UTC (permalink / raw)
To: Peter Maydell; +Cc: Avi Kivity, kvm, qemu-devel
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 8 August 2011 13:56, Avi Kivity <avi@redhat.com> wrote:
>> QEMU deals with a lot of fixed width integer types; their names
>> (uint64_t etc) are clumsy to use and take up a lot of space.
>>
>> Following Linux, introduce shorter names, for example U64 for
>> uint64_t.
>
> Strongly disagree. uint64_t &c are standard types and it's
> immediately clear to a competent C programmer what they are.
> Random qemu-specific funny named types just introduces an
> unnecessary level of indirection.
>
> We only just recently managed to get rid of the nonstandard
> typenames for these from fpu/...
Agreed. And if we want to change them to be "linux-like", can we just
use the linux names? Using a name with uppercase just looks doubly
wrong on my eyes.
Later, Juan.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-08-09 13:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 12:56 [Qemu-devel] [PATCH] Introduce short names for fixed width integer types Avi Kivity
2011-08-08 13:00 ` Anthony Liguori
2011-08-08 13:12 ` Avi Kivity
2011-08-08 13:17 ` Anthony Liguori
2011-08-08 13:19 ` Avi Kivity
2011-08-08 14:17 ` Kevin Wolf
2011-08-08 13:19 ` Peter Maydell
2011-08-09 10:18 ` malc
2011-08-09 12:39 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).