Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: How to optimize this search? Date: Tue, 23 Aug 2022 12:17:02 -0700 Organization: None to speak of Lines: 35 Message-ID: <87wnayydld.fsf@nosuchdomain.example.com> References: <868rneuco0.fsf@linuxsc.com> <93c78669-e681-48bf-b421-ff199e5fcf7an@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="73c88a7a99df6d943496613d23643cfe"; logging-data="3227585"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GZs6RCMlmV0ZN9Pgo3jM3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:NlUpAV+9eeGv7zxNuDrDmtU5huQ= sha1:PQh0qCBsr0qoFDrBbeYMyNklKyw= Xref: csiph.com comp.lang.c:167159 bart c writes: [...] > If input is C source code, then some brief tests suggest that 30-40% of identifiers are keywords, the rest are used-defined. > > For the test input sqlite3.c + shell.c + shell.h, 30% were keywords. And the most common were (counts shown): > > 46066 define > 10005 if > 09531 int > 03522 endif > 03468 return > 03053 char > 02924 void > 02802 else > 02366 const > 01491 static > 01461 struct > 01369 typedef > .... "define" and "endif" would be recognized by the preprocessor, which doesn't know about "int", "return", et al. After preprocessing, "define" and "endif" don't have to be recognized. It would be difficult to have a correct C implementation in which "define" and "int" both need to be recognized by the same code. And that's a *lot* of "define"s. It sounds like the code you're looking at is not typical. Your numbers don't match what I see in the latest sqlite3 sources. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */