Skip to content

Commit 672234d

Browse files
committed
[LINT] error 1759
Postfix increment/decrement operator 'DynamicIDManager::operator++(int)' returns a reference. It's standard for C++ postfix increments to return a value instead of a reference. The opposite is unusual at best. So instead of returning a value, which would be rather inefficient, I've modified the code to use a prefix increment instead, which is more in line with how C++ works in most cases. See http://www.codeguru.com/forum/showthread.php?t=231052 (amongst many) for more details. Signed-off-by: Jocelyn Legault <[email protected]>
1 parent e8de45e commit 672234d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

PythonScript/src/DynamicIDManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ idx_t DynamicIDManager::currentID()
6868
return m_nextID;
6969
}
7070

71-
DynamicIDManager& DynamicIDManager::operator++(int)
71+
DynamicIDManager& DynamicIDManager::operator++()
7272
{
7373
// If nothing has ever been allocated
7474
if (m_current == m_idList.end())

PythonScript/src/DynamicIDManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class DynamicIDManager
3333

3434
void addBlock(idx_t start, size_t quantity);
3535

36-
// Post-increment operator
37-
DynamicIDManager& operator++(int);
36+
// Prefix increment operator
37+
DynamicIDManager& operator++();
3838

3939

4040
int capacity() { return m_capacity; }

PythonScript/src/MenuManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, std::strin
479479

480480
++position;
481481

482-
(*m_scriptsMenuManager)++;
482+
++(*m_scriptsMenuManager);
483483

484484
found = FindNextFileA(hFound, &findData);
485485
}
@@ -734,7 +734,7 @@ void MenuManager::reconfigure()
734734

735735
}
736736

737-
(*m_dynamicMenuManager)++;
737+
++(*m_dynamicMenuManager);
738738

739739
++position;
740740
}
@@ -776,7 +776,7 @@ void MenuManager::configureToolbarIcons()
776776
icons.hToolbarIcon = NULL;
777777
m_toolbarCommands.insert(std::pair<int, std::string>(m_toolbarMenuManager->currentID(), WcharMbcsConverter::tchar2char(it->first.c_str()).get()));
778778
::SendMessage(m_hNotepad, NPPM_ADDTOOLBARICON, m_toolbarMenuManager->currentID(), reinterpret_cast<LPARAM>(&icons));
779-
(*m_toolbarMenuManager)++;
779+
++(*m_toolbarMenuManager);
780780
}
781781

782782
}

0 commit comments

Comments
 (0)