* Code standards
@ 2009-05-27 12:46 =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-05-27 14:27 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont @ 2009-05-27 12:46 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
Hello,
I assume the coding styles are the "usual" ones, and the last thing I want is
to start a flame war about those. But which C dialect is Ofono supposed to be
written in? plain C89, C89 syntax + C99 library, full C99, GNU C... ?
--
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Code standards
2009-05-27 12:46 =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
@ 2009-05-27 14:27 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2009-05-27 14:27 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 585 bytes --]
Hi Remi,
> I assume the coding styles are the "usual" ones, and the last thing I want is
> to start a flame war about those. But which C dialect is Ofono supposed to be
> written in? plain C89, C89 syntax + C99 library, full C99, GNU C... ?
the coding style of oFono is the same as for the Linux kernel, BlueZ,
ConnMan, obexd etc. So basically checkpatch.pl patches are fine.
When using ./bootstrap-configure is used it enables a certain set of GCC
warnings and it should be warnings free. So that is good measurement for
the style details ;)
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Code standards
@ 2009-05-28 8:13 =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-05-28 15:08 ` Denis Kenzior
0 siblings, 1 reply; 4+ messages in thread
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont @ 2009-05-28 8:13 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]
Hello,
> > I assume the coding styles are the "usual" ones, and the last thing I
want is
> > to start a flame war about those. But which C dialect is Ofono supposed
to be
> > written in? plain C89, C89 syntax + C99 library, full C99, GNU C... ?
> the coding style of oFono is the same as for the Linux kernel, BlueZ,
> ConnMan, obexd etc. So basically checkpatch.pl patches are fine.
I am not wondering what the cosmetic style is. I am wondering what parts of
the C language are used. Namely many (most?) C programmers claim to use
ANSI C a.k.a. C89 even though there are using lots of GNU C and/or C99
extensions. Inline functions, C++-styled comments, non-constant variable
initializers, variadic macros, named initializers for structs and
fixed-size integer types and (v)snprintf() are perhaps the most commonly
used C99 features. Restricted pointers, variable-sized arrays, mixed
variables and code (including C++-style for() loops), new printf() format
modifiers (e.g. %zu for size_t), booleans and compound initializers are
arguably more "controversial" or less commonly used, but nevertheless
standard.
I tend pretty much all of them (and avoid GNU-specifics like a :? b)
because I don't care about legacy compilers like gcc 2.x or MSVC, but I
don't want to start a religion war.
A related issue is how careful/pedantic use of integer types should be.
Kernel core or glib tend to be sloppy about int vs (s)size_t.
> When using ./bootstrap-configure is used it enables a certain set of GCC
> warnings and it should be warnings free. So that is good measurement for
> the style details ;)
As a matter of fact, current HEAD is failing here with gcc 4.3:
../../src/voicecall.c: In function ‘ofono_voicecall_notify’:
../../src/voicecall.c:1239: error: ‘v’ may be used uninitialized in
this function
--
Rémi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Code standards
2009-05-28 8:13 Code standards =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
@ 2009-05-28 15:08 ` Denis Kenzior
0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2009-05-28 15:08 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]
Hi,
> I am not wondering what the cosmetic style is. I am wondering what parts of
> the C language are used. Namely many (most?) C programmers claim to use
> ANSI C a.k.a. C89 even though there are using lots of GNU C and/or C99
> extensions. Inline functions, C++-styled comments, non-constant variable
> initializers, variadic macros, named initializers for structs and
> fixed-size integer types and (v)snprintf() are perhaps the most commonly
There is no formal written down standard. Do keep in mind that oFono is a
core linux daemon, hence we don't care about compilers other than gcc. That
means we use lots of _GNU_SOURCE and gcc extensions, especially when they make
the code simpler and easier to follow.
As a simple rule: if a certain style element has been used in oFono before, it
is safe to assume it can be used again. However, the maintainers have the
final say on coding style issues.
> used C99 features. Restricted pointers, variable-sized arrays, mixed
> variables and code (including C++-style for() loops), new printf() format
> modifiers (e.g. %zu for size_t), booleans and compound initializers are
> arguably more "controversial" or less commonly used, but nevertheless
> standard.
> I tend pretty much all of them (and avoid GNU-specifics like a :? b)
> because I don't care about legacy compilers like gcc 2.x or MSVC, but I
> don't want to start a religion war.
>
> A related issue is how careful/pedantic use of integer types should be.
> Kernel core or glib tend to be sloppy about int vs (s)size_t.
>
> > When using ./bootstrap-configure is used it enables a certain set of GCC
> > warnings and it should be warnings free. So that is good measurement for
> > the style details ;)
>
> As a matter of fact, current HEAD is failing here with gcc 4.3:
> ../../src/voicecall.c: In function ‘ofono_voicecall_notify’:
> ../../src/voicecall.c:1239: error: ‘v’ may be used uninitialized in
> this function
This was not being reported on gcc 4.3.2, but has been fixed upstream
nevertheless.
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-28 15:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 8:13 Code standards =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-05-28 15:08 ` Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2009-05-27 12:46 =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-05-27 14:27 ` Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.