Skip to content

Conversation

@eeeeeeeelias
Copy link

No description provided.

@eeeeeeeelias eeeeeeeelias changed the title Add missing optparse_long_only() and useful macros. Add missing optparse_long_only() and useful macros for Windows. Jun 10, 2019
@eeeeeeeelias eeeeeeeelias changed the title Add missing optparse_long_only() and useful macros for Windows. Add missing optparse_long_only() and useful macros for Windows, also separate definition and implementation. Jun 14, 2019
* field to 0 after initialization.
*/

#ifndef OPTPARSE_IMPLEMENTATION
Copy link

@ShamrockLee ShamrockLee Dec 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense to exclude function declarations and macro definitions when implementation is asked for.

AFAIK, forward declaration is a good practice when writing C. It not only guarentees the consistency between the header and the implementation, but also enables calling another function defined below the current one.

#define TCHAR char
#define _TEXT(x) x
#endif

Copy link

@ShamrockLee ShamrockLee Dec 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are TCHAR and TEXT() macros still relevent? Could TCHAR be converted to int implicitly?
I'm not familiar with Windows. Please feal free to correct me.

https://docs.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings

@brdjns
Copy link

brdjns commented May 12, 2025

It doesn't look like short options work properly when using optparse_long_only, and option order is screwy, too. Alongside the options from the repo examples, I've added -A as a short option corresponding to -amount:

./app -A --delay=4 --brief -a
./app: invalid option -- 'A'

Here, ambiguity doesn't work as intended:

./app-amend --delay=4 --brief -a
./app: option is ambiguous -- 'delay'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants