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

Confusion with anonymous namespace #2324

Closed
chris-mich opened this issue Jun 28, 2019 · 6 comments
Closed

Confusion with anonymous namespace #2324

chris-mich opened this issue Jun 28, 2019 · 6 comments

Comments

@chris-mich
Copy link

Config:

# Uncrustify-0.68.0

indent_class    = true
sp_before_byref = remove
sp_after_byref  = add
sp_after_angle  = force
sp_before_dc    = remove

Input (no changes are expected):

namespace
{

class CMyClass
{
public:
    double Compute( const std::vector< double >& values_ );
};

}

double ::CMyClass::Compute( const std::vector< double >& values_ )
{
    // Do stuff
}

Output:

namespace
{

class CMyClass
{
public:
    double Compute( const std::vector< double >& values_ );
};

}

double::CMyClass::Compute( const std::vector< double > &values_ )
{
    // Do stuff
}

This is a tricky one!! Two things:

  1. White space was removed between "double" and "::"
  2. On the same line, "&" should be next to the type (like in the method declaration)

Not sure if Uncrustify has a way to know that "double" is a return type... ;-)

@guy-maurel
Copy link
Contributor

PR #2327 is a bugfix proposal.
Please test it and report.

@chris-mich: where do you live?

@chris-mich
Copy link
Author

Thank you for the fix, I will give it a try when version 0.70 will be out!
I live in Quebec, Canada.

@guy-maurel
Copy link
Contributor

@chris-mich : Bonsoir! Dans quelle ville?
Je suis déjà passé plusieurs fois entre Montréal, Chibougameau et Pointe de Percé.

@chris-mich
Copy link
Author

Chibougamau, vraiment!! Je n'y suis jamais allé! Vous avez donc fait pas mal le tour, il vous reste la Côte-Nord. ;-)
Pour ma part, je demeure dans la ville de Québec.

@guy-maurel
Copy link
Contributor

Voici mon adresse de courriel: guy.j@maurel.de pour le prochain message.
Au dernier passage, nous avons fait le tour des cantons de l'est et
une pointe au musée acadien de Bonaventure, QC G0C 1E0.
C'est fort intéressant.
À + le plaisir de te lire.

@gmaurel gmaurel closed this as completed Aug 5, 2019
@chris-mich
Copy link
Author

There is still a small problem, but I'm not sure that Uncrustify can do something about it. Here's a simplified version of the original issue.

Config:

# Uncrustify-0.76
sp_before_dc = remove

Input (no changes are expected)

double ::CMyClass::Compute()
{
	return 0.0;
}

Output:

double::CMyClass::Compute()     // <-- Note the space that was removed after "double".
{
	return 0.0;
}

Here, "double" is the return type. "::" before CMyClass is used to indicate that the class was declared in the anynomous namespace.

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

No branches or pull requests

3 participants