mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [UPDATE] gcc NULL strings passed from ternary operators in kernel modules
@ 2011-01-13  7:56 Jeffrey Merkey
  2011-01-17  8:50 ` Américo Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Merkey @ 2011-01-13  7:56 UTC (permalink / raw)
  To: linux-kernel

might help if my examples are correct -- geez...

interesting case with gcc.  The following code example:

printk("%s\n", (value & 1) ? "set": "clear");

will evaluate to NULL unless the ":" character has a space after
static string declaration.

this version

printk("%s\n", (value & 1) ? "set" : "clear");

works.

go figure.   Looks like gcc assumes this case is a C++ construct of
some sort and
evaluates it to NULL.

Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [UPDATE] gcc NULL strings passed from ternary operators in kernel modules
  2011-01-13  7:56 [UPDATE] gcc NULL strings passed from ternary operators in kernel modules Jeffrey Merkey
@ 2011-01-17  8:50 ` Américo Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Américo Wang @ 2011-01-17  8:50 UTC (permalink / raw)
  To: Jeffrey Merkey; +Cc: linux-kernel

On Thu, Jan 13, 2011 at 12:56:39AM -0700, Jeffrey Merkey wrote:
>might help if my examples are correct -- geez...
>
>interesting case with gcc.  The following code example:
>
>printk("%s\n", (value & 1) ? "set": "clear");
>
>will evaluate to NULL unless the ":" character has a space after
>static string declaration.
>
>this version
>
>printk("%s\n", (value & 1) ? "set" : "clear");
>
>works.
>
>go figure.   Looks like gcc assumes this case is a C++ construct of
>some sort and
>evaluates it to NULL.
>

Huh? How can gcc assume that is C++ code?!
Whitespaces definitely should not bother the code.

Which version of gcc are you using?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-17  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-13  7:56 [UPDATE] gcc NULL strings passed from ternary operators in kernel modules Jeffrey Merkey
2011-01-17  8:50 ` Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®