[GSOC] regular expressions beta is here

bearophile bearophileHUGS at lycos.com
Wed Aug 10 11:42:50 PDT 2011


Dmitry Olshansky:

> Braces *are* paragraphs of code,

They sometimes are, but inside functions there are other kinds of "paragraphs".

As an example, this is first-quality C code (partially written by R. Hettinger):
http://hg.python.org/cpython/file/d5b274a0b0a5/Modules/_collectionsmodule.c

If you take a random function from that page, like:

653 static int
654 deque_del_item(dequeobject *deque, Py_ssize_t i)
655 {
656     PyObject *item;
657
658     assert (i >= 0 && i < deque->len);
659     if (_deque_rotate(deque, -i) == -1)
660         return -1;
661
662     item = deque_popleft(deque, NULL);
663     assert (item != NULL);
664     Py_DECREF(item);
665
666     return _deque_rotate(deque, i);
667 }

You see a blank line after "Py_DECREF(item);" despite there is no closing brace. The purpose of those blank lines is to help the person that reads the code to tell apart the various things done by that function. This is C code is well written.


> No gonna work, file I/O is certainly in Phobos, as are network sockets, 
> etc. You can't assert that something external won't fail.

OK.


> I hate being drugged in these discussions, but just can't resist.

I am sorry, but thank you for answering :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list