[ros-bugs] [Bug 4747] New: Please, don't use numeric constants for array sizes

ReactOS.Bugzilla at reactos.org ReactOS.Bugzilla at reactos.org
Sun Aug 2 04:37:28 CEST 2009


           Summary: Please, don't use numeric constants for array sizes
           Product: ReactOS
           Version: TRUNK
          Platform: QEmu
        OS/Version: ReactOS
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: Win32
        AssignedTo: ros-bugs at reactos.org
        ReportedBy: aspotashev at gmail.com
         QAContact: ros-bugs at reactos.org

Commit 41994 is a fix, indeed. But here 11 is:
1. not self-describing
2. a number depending on the size of the array FnidToiCls

I think, here we should use a macro like this:
#define ARRAY_LENGTH(a) (sizeof(a)/sizeof(*a))

1. I spent no more than 300ms to guess the name for the macro, so please, think
it out
2. There may already be such a macro, then I would blame the guys who have even
seen these lines of code 100 times more heavily.

COMMIT 41994:
--- a/reactos/subsystems/win32/win32k/ntuser/class.c
+++ b/reactos/subsystems/win32/win32k/ntuser/class.c
@@ -61,7 +61,7 @@ LockupFnIdToiCls(int FnId, int *iCls )
   int i;

-  for ( i = 0; i < 10; i++)
+  for ( i = 0; i < 11; i++)
      if (FnidToiCls[i].FnId == FnId)

P.S.: How to post comment on commits to svn?

Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the Ros-bugs mailing list