Re: Token pasting/concatenation question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would probably just do this:

#define API_URL(tail) "http://localhost:2000/api/"; #tail
#define URL_GET_USER_DATA API_URL(/get/user/data.json)


On Wed, Apr 22, 2009 at 10:16 AM, Jon Drukman <jdrukman@xxxxxxxxx> wrote:
> I want to do the following:
>
> #define API_URL(tail) @"http://localhost:2000/api/##tail";
>
> #define URL_GET_USER_DATA API_URL(/get/user/data.json)
>
> and then when I refer to URL_GET_USER_DATA later in the code, it should
> expand to @"http://localhost:2000/api/get/user/data.json";
>
> I can not get "tail" to expand in the API_URL macro.  I've tried every
> combination of single and double pound signs.  (Well, every combination
> except for whatever the correct one is, obviously.)
>
> gcc 4.0.1 on mac os X, trying to build an iPhone app in Objective-C.
>
> Thanks for any help.
> -jsd-
>
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux