delorie.com/archives/browse.cgi | search |
Message-ID: | <001a01c1651f$dfc66fc0$4bd24dd5@piec> |
From: | "Piotr Fusik" <P DOT Fusik AT elka DOT pw DOT edu DOT pl> |
To: | <djgpp AT delorie DOT com> |
Subject: | gcc: switch() optimization |
Date: | Sun, 4 Nov 2001 11:56:22 +0100 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 5.50.4522.1200 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
X-Virus-Scanned: | by AMaViS perl-11 elektron |
Reply-To: | djgpp AT delorie DOT com |
Consider following example: int main(int argc, char *argv[]) { switch (argc & 1) { case 0: return 10; case 1: return 20; } } gcc version 2.95.3 20010315/djgpp (release) with -O2 generates a redundant check for the range of (argc & 1). Same is for switch (x & 0xff) with all 256 cases. I'm unsure if it's DJGPP or gcc problem. If it's gcc's, maybe gcc 3.0.0 solves it? If so, when will it be available for DJGPP?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |