octol / vim-cpp-enhanced-highlight

Additional Vim syntax highlighting for C++ (including C++11/14/17)
MIT License
1.06k stars 152 forks source link

Add missing socket related functions #78

Closed cataldor closed 4 years ago

cataldor commented 4 years ago

Hello, this adds socket related functions to the set of C functions

dawikur commented 4 years ago

I have strong feeling those functions are not a part of the c++ standard...

cataldor commented 4 years ago

Hello, they were added to the C syntax file, not to the C++; as far as i understand, the C syntax file is not used for cpp files.

Besides, they conform to the POSIX standard. They should be supported by C++ as well. I could create a new type of function (POSIXFunction) to clarify this instead of reusing AnsiFunction

dawikur commented 4 years ago

Ah, yes, sorry. What I should have wrote is 'are not part of the C/C++ standard'. I have always thought about this project as a 'C++ standard syntax'.

I would definitely opt for making it clear in code it is NOT part of C/C++ standard. maybe even hide it behind some option, something like let g:cpp_posix_standard ? It actually would be nice feature. (same for BSD PR, let g:cpp_bsd_standard?)

BTW, do you know some good resource for posix/bsd references?

cataldor commented 4 years ago

Hello, i have updated the branch to allow the user to hide/enable POSIX functions with g:cpp_posix_standard. Let me know if it is ok. I'm still limiting this change to C only; however, i can port this to the C++ syntax file as well, if you wish.

The references for POSIX i'm using are the man pages (in Linux, they have suffixes 3p). There is also the standard themselves (2001, 2008, ..). For now, i was focusing on the socket-related functions. There may be other functions missing from the list.

For BSD i've used the libbsd man pages, as it allows Linux to use the BSD extensions that are not natively supported by it.

dawikur commented 4 years ago

Yep, look better to me :)

octol commented 4 years ago

Thanks! :)