I have the following code in some source I am looking at but I have never seen it before. Can someone tell me what it means? The code snippet is below:

[B]#define SET_EXPIRE(sa, delta, exp){[/B]
   [B]if[/B](((sa)->ipsa_ [B]## delta) != 0){[/B]
      (sa)->ipsa_ [B]## exp = sadb_add_time((sa)->ipsa_addtime,[/B]
        (sa)->ipsa_ [B]## delta);[/B]

What does the ## mean? This is code that is compiled in Solaris.

It's called Token Concantination. See this wiki article about preprocessor directives. Scroll down until you find the section titled "Token concatenation".

[Edit] Oops! Didn't see your answer Narue.

Edited 5 Years Ago by Ancient Dragon: n/a

It's called Token Concantination. See this wiki article about preprocessor directives. Scroll down until you find the section titled "Token concatenation".

[Edit] Oops! Didn't see your answer Narue.

Thank you both for your replies. I appreciate it. Learned something new! :)

Although it wasn't asked for, I would imagine that a backslash \ would be required to terminate all but the last line.

I would also imagine that two terminating curly braces }} would be required on the last line.

Edited 5 Years Ago by _avishek: n/a

Although it wasn't asked for, I would imagine that a backslash \ would be required to terminate all but the last line.

I would also imagine that two terminating curly braces }} would be required on the last line.

I skipped a couple things in the essence of time. I didn't write it, just copied most of it. I was only concerned with the ## part. I know what the rest means. The back slashes were there. I don't recall about the curly braces but I am sure they were there or it wouldn't compile. Thanks for the extra info though. Much appreciated.

This article has been dead for over six months. Start a new discussion instead.