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

Incorrect spacing in C/C++ pointer type variable definitions #11

Open
davidshepherd7 opened this issue Jun 29, 2015 · 4 comments
Open

Comments

@davidshepherd7
Copy link
Owner

We still can't distinguish between multiplication and pointer variables outside of function argument lists.

So for example

Thingy*my_thingy;

becomes

Thingy * my_thingy;

even though it's (probably) a pointer variable not a multiplication.

Related to #7

@andreas-roehler
Copy link

*mypointer = 20;
works for me.

++(*current);
fails.

Might a dereference be signaled in the midst of a [a-z]string?

@davidshepherd7
Copy link
Owner Author

Moved from #8, because I think this is where you intended to ask the question:

Spotted so far this:

electric-operator-c-pointer-type-style 'variable
"Defines how C/C++ mode pointer and reference types are spaced.
If set to 'variable' then the operator is touching the variable
name, as in int *x'. If set to 'type' then the operator is touching the type name , as in int* x'."

;;;;

Is this really a matter of style? I.e. are int *x' and int* x' semantically equal?

Yeah this is entirely a matter of style.

*mypointer = 20;
works for me.

++(*current);
fails.

Might a dereference be signaled in the midst of a [a-z]string?

Yeah, I'm using a bunch of heuristics at the moment which will make the most common cases work but they aren't always good enough.

@andreas-roehler
Copy link

Think this regexp might be changed to: space operator only if not at BOL and require being after alphanumeric and underscore (i.e. permitted symbol-character):

Result: #s(electric-operator-compiled-rule :operator "" :regex "\([ ]\)\\([ ]\)" :action electric-operator-c-mode-*)

WDYT?

@davidshepherd7
Copy link
Owner Author

davidshepherd7 commented Oct 17, 2018 via email

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

2 participants