<div dir="ltr"><div><div><div><div><div><div><div>Hi,<br><br>On Sun, Jan 13, 2013 at 12:09 PM, horseriver <<a href="mailto:horserivers@gmail.com">horserivers@gmail.com</a>> wrote:<br>><br>> On Sun, Jan 13, 2013 at 09:27:45PM -0800, Dave Hylands wrote:<br>
> > Hi,<br>> ><br>> > On Sun, Jan 13, 2013 at 11:29 AM, horseriver <<a href="mailto:horserivers@gmail.com">horserivers@gmail.com</a>> wrote:<br>> > ><br>> > > hi:<br>> > ><br>
> > > In kernel code . some function is defined by<br>> > __attribute__((__section__(".initcall" level ".init")))<br>> > ><br>> > > what does this do ?<br>> ><br>
> > It puts the address of the function in a linker section named<br>> > .initcallX.init where X is replaced by the level.<br>><br>> why ".initcall" and level do not connect together with ## ?<br>
> As I know , precompiler use ## to connect two strings<br><br><br></div>That's not quite true. ## is the token pasting operator and is for pasting together pieces of a token to create a larger token.<br><a href="http://gcc.gnu.org/onlinedocs/cpp/Concatenation.html">http://gcc.gnu.org/onlinedocs/cpp/Concatenation.html</a><br>
<br></div>If you have the tokens someVar_ and somethingElse you could token paste them together to make someVar_somethingElse<br><br></div>The # operator is a for stringizing,which converts non-strings into strings.<br><a href="http://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification">http://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification</a><br>
<br></div>In C and C++ you can "paste" strings together by just putting them one after the other.<br><br></div>const char *x = "This is a long string.";<br><br></div>is 100% identical to<br><br></div>
const char *x = "This" " is a long " "string.";<br><a href="http://en.wikipedia.org/wiki/C_syntax#String_literal_concatenation">http://en.wikipedia.org/wiki/C_syntax#String_literal_concatenation</a><br>
<div><div><div><div><div><div><div><div><br>--<br>Dave Hylands<br>Shuswap, BC, Canada<br><a href="http://www.davehylands.com">http://www.davehylands.com</a></div></div></div></div></div></div></div></div></div>