Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: *scanf efficiency for patterns

Reply
Thread Tools

Re: *scanf efficiency for patterns

 
 
Peter Nilsson
Guest
Posts: n/a
 
      08-27-2003
Christopher Benson-Manica <(E-Mail Removed)> wrote in message news:<bigcrr$10o$(E-Mail Removed)>...
> How efficient are the *scanf functions when used for pattern matching?


The C Standards do not specify levels of efficiency.

> Specifically, is something like
>
> const char * my_str = "Hello, world!";
> int m;
>
> m=sscanf( my_str, "%*[a-zA-Z], %*[a-zA-Z]!" );


Note that the use of - in the scansets is implementation defined. So
your request need not match the way you might expect.

> if( m != 2 ) /* bad string */


This condition is always true as you do not make any conversion
assignments.

> ...
>
> faster, slower, or the same as proceeding character by character through the
> string or stream in question?


Try it, if you're interested in wasting time on micro-optimisation.
But the answers are not supportable by the standards, therefore they
are off topic to clc.

--
Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
perl efficiency -- fastest grepping? Bryan Krone Perl 1 11-08-2004 11:15 PM
where to find good patterns and sources of patterns (was Re: singletons) crichmon C++ 4 07-07-2004 10:02 PM
Re: *scanf efficiency for patterns Malcolm C Programming 1 08-27-2003 09:44 PM
CISCO 1721 efficiency problem DarejDok \(Dariusz Dħbrowski\) Cisco 0 07-16-2003 07:15 AM
dataset efficiency question Trevor Hartman ASP .Net 0 07-03-2003 08:20 PM



Advertisments