Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7970655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:26:41+00:00 2026-06-04T07:26:41+00:00

Is there a way to change variables’ naming conventions in Eclipse (specifically Eclipse CDT)?

  • 0

Is there a way to change variables’ naming conventions in Eclipse (specifically Eclipse CDT)? For example, can I do a search-and-replace of variables with names like need_foo and change that to NeedFoo?

Adding and removing underscores is easy, obviously, but I don’t see a way to change case. Perl’s regexes have \u and \l modifiers to uppercase and lowercase characters, but Eclipse’s apparently don’t.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:26:43+00:00Added an answer on June 4, 2026 at 7:26 am

    There’s no automated way of mass-renaming multiple non conforming function names in CDT. There is, however, a Code Analysis rule, which is designed to point out these sort of things. It uses Eclipse Regex described in their online help. These will give you an “Information” level marker in your Problems View.

    The way they work is matching a regex against each function name, and raising an error/warning/information if that doesn’t return a match. You can access them via “Window->Preferences->C/C++->Code Analysis”. It’s about half way down the scroll list (in Eclipse Indigo).

    To directly answer your second paragraph, Eclipse does not have an equivalent of Perl’s \u and \l, the closest it has is (?ismd-ismd), which allows you to turn on matching based on case.

    Depending on if the Code Analysis tool returns 5 or 50,000 errors:

    Only a few function definitions to rename

    You can use the standard refactoring renaming tool. Right click the function name, “Refactor->Rename” will replace all references to that function with your new function name (respecting different scopes).

    Many many errors

    This is… not as nice. Seeing as there’s no built in method, you need to do it externally. The first approach I’d take is to see if there’s an existing plugin out there that would do this.

    Failing that, what you could perhaps do is use the Code Analysis tool to identify non-conforming function names, and then using the output from that as input to a custom Perl script? You could do it in a few stages:

    void FooBar(void) {}
    int main(int argc, char *argv[])
    {
        FooBar();
        return 0;
    }
    

    1) Run the code analysis, and copy and paste the warnings into a text file:

    Bad function name "FooBar" (pattern /^(?-i:([a-z]+_[A-Z])|[a-z])(?i:[a-z]*)\z/) main.c  /TestMultiThread    line 47 Code Analysis Problem
    

    2) Change the function definition, fooBar() –> FooBar(), using the above errors as input for a perl script (note you have the badly-conforming-function name, the file name and line number).

    3) Compile it and then use the output from the compiler’s undefined reference to fooBar() to rename any references:

    undefined reference to `FooBar' main.c  /TestMultiThread    line 50 C/C++ Problem
    

    This method would have some short comings, such as the compiler giving a partial list of undefined references due to the compilation terminating ‘early’, in which case you’d want to run it multiple times.

    Another thing to look at is Refactor Scripts (Refactor –> Apply Script), but from the little I’ve seen of that, I don’t think it’s going to do what you want.

    All in all, I’ve found the refactoring tools in Eclipse CDT to be no where near as powerful as those for Java (from what I remember). Still better than those in Notepad though (also, not bashing CDT, it’s an awesome development environment!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to change the root object in JavaScript? For example, in
Is there any way to change the BackColor of the border of a panel
Is there any way to change the icon of an application after it is
Is there a way to change location of IsolatedStorage files? I am using .NET
Is there a way to change the root folder for the views to the
Is there a way to change the alignment of the icon or text of
Is there a way to change the value contained in an NSNumber after it
Is there a way to change the order of the controls inside a StackPanel
Is there a way to change the application language during runtime? So, after the
Is there a way to change the default ajax progressbar that is there in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.