Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse C/C++ CDT (Pointer alignment for Typecasting)(Eclipse C/C++ CDT (Pointer alignment for Typecasting))
Eclipse C/C++ CDT (Pointer alignment for Typecasting) [message #1822092] Thu, 27 February 2020 07:32 Go to next message
Muhammad Wasim Akhtar Khan is currently offline Muhammad Wasim Akhtar KhanFriend
Messages: 9
Registered: February 2020
Junior Member
Dear All

I am trying to align the typecasting (FORMATTING) using C/C++-> Code Style-> Formatter-> Whitespace

But I want the formatting of the typecast in the following stye:

(*(uint64_t *const) someVariable);

The Problem is Eclipse 4.14 format the typecast in the way shown below:

(*(uint64_t* const ) someVariable);

I want the pointer to be attached to const NOT uint64_t and also I donot want the spacing after const as shown above. HELP ME in this regard.

Many Thanks
Re: Eclipse C/C++ CDT (Pointer alignment for Typecasting) [message #1822192 is a reply to message #1822092] Sat, 29 February 2020 15:56 Go to previous messageGo to next message
Nick Schweyer is currently offline Nick SchweyerFriend
Messages: 175
Registered: July 2009
Senior Member
I am not an expert in C/C++ but will try to give an answer or at least a point for discussion.

Quote:
I want the pointer to be attached to const NOT uint64_t

A pointer is a pointer to a variable, in this case a variable of type uint64_t. The compiler/linker will know where the variable is located and generate the physical address as value of the pointer.
When you define the variable as const then this is a special feature of this variable, and the compiler will generate an error (maybe a warning) if anywhere in the program the value of this variable shall be changed.
Anyway with or without const the pointer always will point to the adress of the variable. The pointer cannot point to the feature const.

Quote:
... and also I donot want the spacing after const as shown above

For the compiler it is irrelevant if there is a spacing or not. With spacing is the common way to type.



Niko

Eclipse-CDT Version: 2019-12 (4.14.0), Win10 64bit
Re: Eclipse C/C++ CDT (Pointer alignment for Typecasting) [message #1822230 is a reply to message #1822192] Mon, 02 March 2020 08:37 Go to previous message
Muhammad Wasim Akhtar Khan is currently offline Muhammad Wasim Akhtar KhanFriend
Messages: 9
Registered: February 2020
Junior Member
@Nick Schweyer

Hi Nick, I completely agree with You but I just to format typecasting using predefined standards that's why I am asking that whether in Eclipse we have some setting to introduce space or asterisk (*) alignment by our own choice. I have sen in eclipse CDT C/C++ under C/C++-> Formatter-> WhiteSpace-> .. There are some option with respect to spacing but no options with regard to asterisk alignment specifically under Type casts option.
Previous Topic:register view Highlight not accurate
Next Topic:Nested Struct/Class indentation in Eclipse not OK
Goto Forum:
  


Current Time: Fri Apr 26 00:00:43 GMT 2024

Powered by FUDForum. Page generated in 0.02433 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top