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

[Question]: class vs namespace in CodeLite/fileutils.cpp ? #3563

Open
UffeJakobsen opened this issue Jan 6, 2025 · 1 comment
Open

[Question]: class vs namespace in CodeLite/fileutils.cpp ? #3563

UffeJakobsen opened this issue Jan 6, 2025 · 1 comment
Assignees
Labels

Comments

@UffeJakobsen
Copy link
Contributor

UffeJakobsen commented Jan 6, 2025

[Question]: class vs namespace in CodeLite/fileutils.cpp ?

The FileUtils class in CodeLite/fileutils.cpp contains all public static functions (well except for Deleter embedded class)

Maybe I've missed a detail here - but is there any reason for not just keeping these public static functions in a namespace (called FileUtils) ?

@Jarod42
Copy link
Contributor

Jarod42 commented Jan 9, 2025

Pro and cons of static class versus namespace:

  • JAVA style
  • private access by class and not by file, irrelevant here ( No private/protected, and single file)
  • no shortcut (ala using namespace FileUtils), No ADL.
  • unique WXDLLIMPEXP_CL (dllexport/dllimport MACRO), instead of doing it for each functions.
  • implementations can be split in several cpp, but not the declarations in several .h (whereas for namespace , both can be split)

So mostly similar, and differ by styles.
I tend to prefer namespace style too.
but up to Eran.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants