Menu

Cannot use Dev-C++ because of "Feature"

a9642
2009-02-24
2012-09-26
  • a9642

    a9642 - 2009-02-24

    I would very much like to use Dev-C++ but a certain feature continues to get in my way so much so that I cannot write using it. Before I continue, I should state that my operating system is WinXP SP2, and that the version of Dev-C++ I am running is 4.9.9.2. On to the problem.

    Consider a section of code indented thus:
    identifier{
    ----code_block

    If my cursor is at the end of the word "block" and I wish to close the code block on the next line, all I normally have to do is hit return/enter and type the closing bracket. Dev-C++ will then (if the appropriate options are selected) go back one level of indentation and place the closing curly bracket, resulting in the following code:

    identifier{
    ----code_block
    }

    That works perfectly for almost everyone out there. What if I want the following, though?:

    identifier{
    ----code_block
    ----}

    Now before I'm surrounded by the howling monkeys who find it necessary to point out exactly how objectively wrong that is, let me just state that I've been programming like that for many years, and I'm surrounded by others who program the same way. I'm not going to change, and I'd like to find an IDE which is easy for me to use. I would like to be able to use the built-in options to configure the IDE to my programming style, but this seems to be impossible given the options provided. I am attempting to use the "Editor Options" window (under the tools menu) to configure the IDE, I have not yet found the necessary features.

    If anyone knows a way to customize Dev-C++ to achieve the behavior I'm looking for, I would appreciate the help. Also, if you know for a fact that Dev-C++ does not support my style of programming, please say so and prevent me from swearing at my laptop any more than I already have. If you need any further clarification to answer my question, just ask and I'll provide whatever info you need.

    Just to restate the behavior I'm looking for, all I want is for the program to (on hitting return/enter) insert the same amount of indentation as was used on the previous line. I would like this to happen without any sort of magical nomadic curly brace behavior.

    Thanks in advance.

     
    • cpns

      cpns - 2009-02-25

      > without the strange bracket placement

      No you want it with the strange bracket placement. The default placement is in fact conventional - in C++ at least.

      I no longer bother to install Dev-C++ so I cannot experiment to determine if there is a solution. I generally use Microsoft's free VC++ Express Edition which frankly is better in all respects in any case. I beleve that it will support what you want if you set teh following options:

      Tools->Options->Text Editor->C/C++->Tabs->Indenting->Block
      Tools->Options->Text Editor->C/C++->Formatting->Indentation->Indent braces

      Note that the second option only applies to the "Format Selection" option, where you select the code and type Ctrl-K+Ctrk-F to apply the style. You may find that useful because most third-party code that you might reuse will not conform to your preferred style. I use it to sort out unformatted code posted to this forum.

      It is not as flexible as a professional code editor such as Visual SlickEdit (v. expensive), but for free it is hard to beat.

      Clifford

       
    • landrun

      landrun - 2009-02-24

      I can't tell you how to configure Dev C++.
      But I can tell you that if you can get the editor to consistently space/tab the same way then you're miles ahead of me. I've found the spacing in Dev C++ inconsistent at best.

       
    • cpns

      cpns - 2009-02-24

      > objectively wrong

      Actually the wrongness is entirely subjective. Subjectively speaking, bith your examples are 'wrong'!

      Face facts, unless you can find an editor that supports your particular unusual style, you are going to be constantly fighting this battle. Your best bet is to turn off the auto-indent and place the braces yourself. I always found the "smart indent" feature in Dev-C++ to behave particularly oddly, but that may just be because it is behaving the way you want, so try that.

      [landrun]> I've found the spacing in Dev C++ inconsistent at best.

      Try turning off the brain damaged 'smart indent'. Although that may be exactly what a9642 actually needs - to switch it on that is.

       
    • a9642

      a9642 - 2009-02-25

      I've been using an IDE for another language for years that behaves perfectly for any indenting style, so I was very surprised when I tried to switch to C++ and found that no IDE supports this very simple feature. All the editor needs to do is indent as far as the previous line was indented. It seems like such a simple concept, and Dev-C++ does it perfectly, only it bundles that feature with another unrelated feature which bugs me to no end (the auto-moving bracket). The problem is simply that whoever wrote that feature assumed that everyone uses the same indenting style.

      Again, if anyone knows a way to get auto indenting without the strange bracket placement, please let me know. I'd be willing to install a plugin, patch, edit the hex code, whatever. If anyone knows of another C++ IDE which has a proper auto-indent, that would also be appreciated, because I haven't found one yet.

      [cpns]> I always found the "smart indent" feature in Dev-C++ to behave particularly oddly, but that may just be because it is behaving the way you want, so try that.

      Not at all. I completely agree with you that "smart indent" is brain damaged. Auto indent does exactly what I want, except that it moves the closing bracket around, which is something I don't want. The frogert is also cursed.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.