Attention: PROnetworks has upgraded our forum from phpbb2 to phpbb3!!

Please head over to our new converted forum at: http://www.pronetworks.org/forums/

This old forum will remain 'read-only' until approximately February 2009. We look forward to seeing you at the new forum!
Author Message
Weaver
PostPosted: Thu May 20, 2004 1:42 am Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
It is about 1 am here. Bored out of my mind perusing through some source code written by the greatest computer scientist alive today. I ran across Daniel Bernstein's str_len() function. For those unfamiliar, it is written in C.

Code:
unsigned int str_len(const char *s)
{
  register const char *t;

  t = s;
  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;
  }
}


Has to be hands down the most interesting approach I have ever seen. I spent a good 10 minutes in awe on this one. This guy is what I like to call an "out of the box" thinker. This function was included in his daemontools package with filename str_len.c

Daniel J Bernstein (DJB) is the author of qmail and many other very secure *nix packages. If you want to check out more of his work, head on over to http://cr.yp.to

-Weaver
 
Back to top
imnuts
PostPosted: Thu May 20, 2004 11:09 am Reply with quote

Support Team
 
 


Joined: 24 Mar 2004
Posts: 14585
Location: Boothwyn, Pennsylvania
if i could only understand what it was saying so i could sit and stare in awe too. weaver, is there any end to your knowledge, it seems that you know the answer to all of the technical questions
 
Back to top
Weaver
PostPosted: Thu May 20, 2004 5:19 pm Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
imnuts wrote:
if i could only understand what it was saying so i could sit and stare in awe too. weaver, is there any end to your knowledge, it seems that you know the answer to all of the technical questions


I wish my knowledge basin was an abyss. In the computer science and information technology (I hate the word IT) realm I try to be very well rounded. Move out of that realm and its related topics (Mathematics, Physics) and you'll find that I am quite disabled. My better half (who also happens to be my roommate) is studying nursing. Her chemistry and biology knowledge is amazing, I find myself trying to learn what she is doing but just cannot seem to hold the information.

My advice is first and foremost to read a lot. You don't have to read novels, but pick up technical literature that you find interesting. Read slashdot, browse at a threshhold of at least 3. Slashdot can be a double edge sword, so take what you read with a grain of salt.

The most important thing you can do is be motivated and excited to learn. If you are not excited by your major/career, pick a new one. You will never be an expert if you do not go beyond what is asked and required. The most important skill to have is fundamentals. You may say cliche, but for being cliche I don't see too many people who have their fundamentals down.

You have to know the basics, and know them well. If you don't, high levels of abstraction and abstracted concepts all seem like magic. You need to understand the foundation, without it you can still succeed, but by the seat of your pants. Sooner or later you will be confronted and put in your place.

-Weaver
 
Back to top
Back to top
Index >> Webmaster Domain & Code Room >> Interesting str_len() by DJB

Page 1 of 1

 


Tired of the Ads? Registered users have 80% less adverts.