(original) (raw)

On 5/30/2017 2:18 PM, Guido van Rossum wrote:
On Tue, May 30, 2017 at 11:49 AM, David Wilson <dw+python-dev@hmmz.org> wrote:
On Tue, May 30, 2017 at 09:38:55PM +0300, Serhiy Storchaka wrote:

\> > In early ages of C structures didn't create namespaces, and member
\> > names were globals.

\> >That's nonsense. The reason is greppability.

\> Good reason!

The first time I heard about prefixing struct members was to allow
tricks like this:

x86\_64-linux-gnu/bits/stat.h
94:# define st\_atime st\_atim.tv\_sec /\* Backward compatibility. \*/
95:# define st\_mtime st\_mtim.tv\_sec
96:# define st\_ctime st\_ctim.tv\_sec

Which is relatively safe thanks to the prefix.

Believe me that is not why the prefix convention was introduced.

Sure, but grepping was not the reason either. Serhiy had the right explanation.