sizeof is also bad, the function should be called "size", "len" or "length".
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-01-20 17:02: Subject: Death to strlen! Death to the demoness Allegra Geller!
I have a theory that strlen is bad.
- The function itself is completly redundant, since it is a direct
alias for sizeof. The language is simpler and faster to learn without strlen. (Although not by much.) 2. We'd like things in Pike to be as general as possible, e.g. + should add any kind of ADT, not just integers. Hence it is bad to make specializations of general functions. 3. As a specialization strlen is flawed, since it accepts nonstring arguments. 4. strlen provides a "transition aid" for C programmers, who can still write strlen and get a somewhat expected result. This advantage is however consumed by the implication that since Pike has strlen and sizeof, and strlen works as in C, sizeof would also work as in C.
Proposed course of actions:
- Document strlen as deprecated.
- Replace all strlen instances in Pike with sizeof.
/ Martin Nilsson (Åskblod)