[Request] Allow "longitude" and "latitude" argument names


#1

Hello.

I am developing a C++ Twitter API library. (https://github.com/Neozaru/LibTwitter-Core)
I use C++ var names , and send them directly in HTTP requests.

-> Problem : The argument “long” (for “longitude”) is also a keyword, in C++ (ie: long int), and most compilers will reject it.

Is it possible to allow “longitude” and “latitude” args for defining “lat” and “long” (“lon” could also be a solution).
Of course, I don’t request name replacement, but more flexibility with these parameters.

Thanks.


#2

Does your C++ interpreter have trouble telling the difference between a string called “long” and the actual functional keyword?


#3

Compiler*
Yes, that’s the problem :wink:


#4

Just, to verify, you would like us to change the API because your code generator is not capable of differentiating between parameter names you send in a HTTP request, vs the names of variables defined in this file:

?


#5

Actually, the problem is more complicated.

In my .cpp code, I have functions like :

do_something_request( string screen_name, int count, … );

I defined macros in order to get directly var names (screen_name, count) as “string” to define value. For the var <screen_name>, the key/value member will be “screen_name”=<value_of_var>.

–> In other words : Var names in my code are parameter keys in requests

This method allow me to save many lines of code, and the only problem comes when I set “long” as var name (because “long” is also a type/keyword, in C++)

See : https://github.com/Neozaru/LibTwitter-Core/blob/master/src/Twitter/Core/RequestCreator.h

Of course, I could correct this manually (I could use “LONG”, and in my Macros, I could check for “LONG”, and convert it to “long”), but if other coders wants to fork the project and add their custom requests (If API is updated, etc), they could meet some problems.

To avoid any ambiguity, i’m not requesting modification right now, but I submit the idea to be flexible on the name of these arguments for future patches/updates.

Thank you for your response. Sorry for my bad English.