Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reserved identifier violation #2

Closed
elfring opened this issue Nov 2, 2019 · 15 comments
Closed

reserved identifier violation #2

elfring opened this issue Nov 2, 2019 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@elfring
Copy link

elfring commented Nov 2, 2019

I would like to point out that identifiers like “PCC_INCLUDED__” and “STRING_FLAG__IDENTIFIERdo eventually not fit to the expected naming convention of the C++ language standard.
Would you like to adjust your selection for unique names?

@arithy
Copy link
Owner

arithy commented Nov 2, 2019

Thank you for your advice.
I replaced every double underscore __ with a single underscore if it is in an identifier that consists of uppercase letters and underscores.
Please check out the branch 'develop'.

@arithy arithy added the enhancement New feature or request label Nov 3, 2019
@arithy arithy self-assigned this Nov 3, 2019
@elfring
Copy link
Author

elfring commented Nov 3, 2019

How do you think about to rename also functions?

@elfring
Copy link
Author

elfring commented Nov 3, 2019

Thanks for your renaming of affected identifiers.

🔮 Can a name selection trigger any corresponding software development concerns?

@arithy
Copy link
Owner

arithy commented Nov 3, 2019

How do you think about to rename also functions?

I don't want to rename them anymore.
I determined the function naming convention like 'class name'__'method name' to distinguish it plainly from other word delimiters '_'.

Can a name selection trigger any corresponding software development concerns?

Sorry, I couldn't understand what you mean.
Could you express it more simply?

@elfring
Copy link
Author

elfring commented Nov 4, 2019

I don't want to rename them anymore.

This implementation detail can be fine according to the naming convention for the programming language “C”.
Can anybody get concerned about remaining risks for undefined behaviour if contents from C files will be treated as C++ source code anyhow?

Could you express it more simply?

Is there a possibility that an identifier will be constructed (together with the prefix “PCC_INCLUDED_”) that does not result in an acceptable include guard?

@MaxBarraclough
Copy link

Identifiers ending with "_t" are also reserved in C++. I see many instances of this in packcc, even in the develop branch. https://stackoverflow.com/a/228797/

I also see "__pcc_in", "__pcc_out", and "__pcc_ctx" in the develop branch, all of which C++ considers to be reserved identifiers due to the leading double underscores.

As @elfring says, C++ has stricter rules than C regarding which identifiers are considered reserved.

@audinue
Copy link

audinue commented Jul 19, 2022

Is this a parser generator for C or C++?

@arithy
Copy link
Owner

arithy commented Jul 19, 2022

Just for C.
You can use it with a C++ compiler, but I don't support such usage.

@audinue
Copy link

audinue commented Jul 20, 2022

Why @elfring asked you to comply with C++ language standard then?

@arithy
Copy link
Owner

arithy commented Jul 20, 2022

Just because @elfring wanted to use PackCC with C++, I think.
I accepted a part of @elfring's suggestion since I thought it had better comply with C++ standard as much as possible.
Anyway, I can close this issue if I strictly stand on the specification: just for C.

@arithy
Copy link
Owner

arithy commented Aug 9, 2022

@elfring, @MaxBarraclough,
I'm going to close this issue because of the following reasons:

  • PackCC generates a C source code in a .c file (not in a file with the C++ extension such as .cpp).
  • PackCC generates a C header file that can be included from C++ source files with no problem.
  • I strongly disagree too vast the identifier pattern that POSIX claims to reserve.

If you have any objection against closing this issue, let me know by the end of this month (Aug. 2022).

@elfring
Copy link
Author

elfring commented Aug 10, 2022

💭 I became curious if interests could grow further for involved standard compliance aspects.

@audinue
Copy link

audinue commented Aug 10, 2022

thought_balloon I became curious if interests could grow further for involved standard compliance aspects.

Why not putting some ads on Youtube instead of violating the scope of this project?

@elfring
Copy link
Author

elfring commented Aug 10, 2022

Some development concerns can be tackled together for the programming languages “C” and “C++”, can't they?

@arithy
Copy link
Owner

arithy commented Aug 14, 2022

I became curious if interests could grow further for involved standard compliance aspects.

It might be just your impression, and isn't persuasive.

Some development concerns can be tackled together for the programming languages “C” and “C++”, can't they?

I never deny using C and C++ together.
I already wrote "PackCC generates a C header file that can be included from C++ source files with no problem".
The generated C code is callable from C++ codes.

@arithy arithy closed this as completed Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants