Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0
From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Nov 08 2002 - 15:19:20 EST
- Next message: Van Maren, Kevin: "RE: [Linux-ia64] reader-writer livelock problem"
- Previous message: Richard B. Johnson: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- In reply to: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Next in thread: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On Fri, 8 Nov 2002, Randy.Dunlap wrote:
?
> Sure, it looks cleaner that way, although gcc has already put <*dig>
> in a local register; i.e., it's not pulled from memory for each test.
> Here's a (tested) version that does that.
Why do you have that "dig" pointer at all? It's not really used.
Why not just do
+ char digit;
...
+ digit = str;
+ if (digit == '-')
+ digit = str[1];
(and maybe it should also test for whether signed stuff is even alloed or
not, ie maybe the test should be "if (is_sign && digit == '-')" instead)
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Next message: Van Maren, Kevin: "RE: [Linux-ia64] reader-writer livelock problem"
- Previous message: Richard B. Johnson: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- In reply to: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Next in thread: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
This archive was generated by hypermail 2b29
: Fri Nov 15 2002 - 22:00:16 EST