473,703 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DJ Bernstein's str library

Hi all,

Plagued by the (to me) non-obvious functionality of DJB's str.h library, I
started looking at the source and what I saw took a while to make sense.

Each function runs an infinite loop, which iterates though a char* - in
order to search for needles or calculate a string length or whatever. What
got me was that each of the infinite loops held 4 identical statements:

for (;;) {
if (!*t) break; if (*t == ch) break; ++t;
if (!*t) break; if (*t == ch) break; ++t;
if (!*t) break; if (*t == ch) break; ++t;
if (!*t) break; if (*t == ch) break; ++t;
}
(in str_chr.c) and

for (;;) {
if (!*t) return t - s; ++t;
if (!*t) return t - s; ++t;
if (!*t) return t - s; ++t;
if (!*t) return t - s; ++t;
}
(in str_len.c)

Does anyone have any ideas as to why this is done? All I can think of is
that 4 chars=32bits and that nicely fills a register.

--
Peter Davies

Nov 15 '05
92 3056
Poldie wrote:
But now there is a class
of users (we'll call them "googlers") that are wearing these funny weird
glasses

There is also a class of users (we'll call them "net nerds") who spend


Googlers is a better pun.
an inordinate amount of time on the internet, and who seem to suffer
delusions of grandeur which make it very very important to them that
every last character they type is preserved, in perfect context, for
all eternity, and the very thought that some people might be treating
the odd thread in the odd group with less than complete seriousness and
simply trying to answer a poster's question is just beyond the pale.


Actually, it's exactly the opposite. News servers throw away old
posts, google keeps them. If someone replys to a thread from last
week without context I haven't a clue what they're talking about
(since I use thunderbird and a news server). I'm not going to
bother looking for the context in google, because it will often
be a waste of time, so I ignore it.

Remember that posts are write once read many. The normal rule of
good writing therefore applys; people won't read what you have
written unless you make it easy for them.

(And, finally, odds-on the poster will remember what they wrote;
no-one else will. If you want a conversation rather than a
discussion there's always email.)

--
imalone
Nov 15 '05 #11
In article <pa************ *************** *@yahoo.co.uk>,
Peter Davies <pe******@yahoo .co.uk> wrote:
....
Note that you are not the first to complain about Google and its effect on
Usenet. However much I may agree with your opinions on that topic, it is
in my opinion extremely rude to hijack threads for the purposes of being
bitchy.


Um, point taken. But my point is that's exactly what the repetitive
bitching, by the "regulars", which boils down to "Don't respond as if
you're responding from Google" (which, as they are, is obviously the
natural [and, dare I say, proper] thing for them to do), amounts to.

Nov 15 '05 #12
In article <sl************ *********@FIAD0 6.norwich.edu>,
Neil Cerutti <le*******@emai l.com> wrote:
On 2005-10-27, Poldie <Po****@gmail.c om> wrote:
Provide context, there is no guarantee that everyone who
sees your post

etc etc

Yawn. Guess what - I don't care.


It's obviously your right to hold that attitude, but it is only
to your advantage if you prefer being ostracized.


Or admired by myself and others like me.

Nov 15 '05 #13
> Googlers is a better pun.

Depends upon what you're punning - I was punning on Googlers, in which
case using the same word wouldn't really have had the same hilarious
comedic effect.
Actually, it's exactly the opposite. News servers throw away old
posts, google keeps them. If someone replys to a thread from last
week without context I haven't a clue what they're talking about
If they have my response then they'll almost certainly have the
original post, especially if - as in this case - the response is posted
soon after the original post.
If you want a conversation rather than a discussion there's always email


Maybe later.

Nov 15 '05 #14
Jordan Abel wrote:
On 2005-10-27, Flash Gordon <sp**@flash-gordon.me.uk> wrote:
Poldie wrote:
Isn't it
Isn't what? Provide context, there is no guarantee that everyone
who sees your post has seen the message you are responding to.


And that is why the References: header was invented.


Bull.
yes, it's irritating. so is reading people complaining about it.


The main way the new Google users (which are flooding usenet) are going
to find out how to behave properly is if people instruct them. You are
in the wrong here.
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Nov 15 '05 #15
Poldie wrote:
Provide context, there is no guarantee that everyone who
sees your post

etc etc

Yawn. Guess what - I don't care.


*plonk*

Brian
Nov 15 '05 #16
Peter Davies wrote:

Please continue whinging here. It will help me and others who are
interested in the original thread to differentiate between usefulness
and fluff.

*plonk*

Brian
Nov 15 '05 #17
In article <3s************ @individual.net >,
Default User <de***********@ yahoo.com> wrote:
....
The main way the new Google users (which are flooding usenet) are going
to find out how to behave properly is if people instruct them. You are
in the wrong here.


Agreed, in principle.

But, with Google as with all things Microsoft, in a very short while, it's
just not going to matter.

Nov 15 '05 #18
Poldie wrote:
Provide context, there is no guarantee that everyone who
sees your post


etc etc

Yawn. Guess what - I don't care.


Guess what - you have just shown your disdain for the other readers of
this newsgroup. Good luck with any questions you might have in the
future. The people who know the answers but whom you have told to fuck
off will not be reading your posts.

*PLONK*
Nov 15 '05 #19
"Poldie" <Po****@gmail.c om> writes:
Provide context, there is no guarantee that everyone who
sees your post

etc etc

Yawn. Guess what - I don't care.


You probably think you don't need to care because you read this
newsgroup through Google. Google provides a badly flawed interface,
but one of its virtues is that it makes it easy to see previous
articles. The majority of us, including most of the regulars, *don't*
use Google, so we can't see older articles as easily as you can.

Those who don't take the time to show some consideration for the rest
of us are far less likely to be able to participate in any meaningful
way.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6468
by: pieter.breed | last post by:
Hi All, The company I work for has traditionally used COM/ActiveX for the solutions that it provides. We are in the process of moving to .NET and a few applications have been written in VB.NET up to this point. Some of the applications are class libraries which need to be callable via the COM interface from some of the older applications. Could someone please explain to me the issues involved in deploying such a class library?
4
3350
by: womanontheinside | last post by:
I have a library which was written in C, you call a function, it provides the result by a callback to specific function names. I am trying to wrap the calls to this inside a class, but this causes a problem with the callbacks, for example: class X { public: add(); };
3
4266
by: K.S.Liang | last post by:
Hi all, 1> If there are more than one dynamic linking libraries in the file system, how do I know which one is loaded into system? Any C library or system call can tell me which *.so or *.sl is active? Can the setting of LD_LIBRARY_PATH guanrantee that the correct one is executed? 2> In MS-WINDOWS, once a DLL is loaded by one allication, this DLL will be used by the subsequent appication. Does UNIX have the same
19
2503
by: Deniz Bahar | last post by:
Hi, I would like to call one of my functions the exact name as an existing C library function (for example K&R2 exercises asks me to make an atof function). If I don't include the header with the declaration for the C library function (stdlib.h in this case) then define/declare my own function with the same name, am I safe? It seems to work on my compiler, but I wonder if this is portable or even acceptable? thx
3
1587
by: Manny Silva | last post by:
Hi, I would like to create a static library that uses and in effect adds to another static library. I could simply add functionality to the existing library, but functionally it doesn't really belong there... that is, the one library is very inspecific. The Library I need to create will be project specific, and I prefer not to have to mix the two... in any case, I tried to create a library that referenced the first library. I added...
1
7099
by: Jim | last post by:
Have fully operational software package developed on VB.NET that worked until Jan 1 2003, with early stage deployments on Oct 10, Oct 23, Nov 11, Dec 12 and Dec 30. When attempted final deployment on Jan 2, 2004 got following messages and errors... I reset everything and tried several times agian. Then erased the setup project and tried to rebuild a new one with the same errors. PLease note... ALL this this code ran perfectly five minutes...
10
1811
by: mwt | last post by:
So in a further attempt to learn some Python, I've taken the little Library program (http://groups.google.com/group/comp.lang.python/browse_thread/thread/f6a9ccf1bc136f84) I wrote and added several features to it. Readers now quit when they've read all the books in the Library. Books know how many times they've been read. Best of all, you can now create your own list of books to read! Again, the point of all this is to get used to...
10
2683
by: Julian | last post by:
I get the following error when i try to link a fortran library to a c++ code in .NET 2005. LINK : fatal error LNK1104: cannot open file 'libc.lib' the code was working fine when built using .NET2003. also, when I do not try to link the fortran library (just to see if that was the cause), it builds the exe without any problems. i don't even know how to begin addressing this problem...any help would be
0
4089
by: JosAH | last post by:
Greetings, the last two article parts described the design and implementation of the text Processor which spoonfeeds paragraphs of text to the LibraryBuilder. The latter object organizes, cleans up and stores the text being fed to it. Finally the LibrayBuilder is able to produce a Library which is the topic of this part of the article. Introduction
0
8755
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8667
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9013
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7860
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4428
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2445
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2063
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.