Home » Developing U++ » U++ Developers corner » Source Code Efficiency Minor Issue
Source Code Efficiency Minor Issue [message #58529] |
Wed, 08 June 2022 18:46  |
aminhere
Messages: 3 Registered: June 2022 Location: Waterloo
|
Junior Member |
|
|
Hello friends,
I recently discovered the U++ framework and I am having great success using it. I would like to sincerely thank the developers for all the hard work.
One recurring issue I have noticed while examining some code constructs like for example 'CodeEditor.cpp' is that all code does not make use of [else if] statements. For example, let us consider this piece of code from the previously mentioned cpp file:
-----------------------------------------------------
if(IsSelection() && auto_enclose) {
if(code == '(') {
Enclose("(", ")");
return true;
}
if(code == '{') {
Enclose("{", "}");
return true;
}
if(code == '[') {
Enclose("[", "]");
return true;
}
}
// MODERATOR: use code tag four source code.
-----------------------------------------------------
I am a novice programmer, and I am of the opinion that if we used [else if] statements for the 2nd and 3rd [if] cases, we would be able to save some processing power no matter how minute.
I understand that more experienced programmers like yourselves already know about this concept. That leads me to believe that this was done for some other reason. I would very much appreciate it if you would help me understand as to why this was done so that I am able to learn from you.
Thank you kindly,
Amin
[Updated on: Wed, 08 June 2022 20:56] by Moderator Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 14 08:19:16 CEST 2025
Total time taken to generate the page: 0.04070 seconds
|