> On Apr 28, 2018, at 8:45 AM, Antoine Pitrou <solipsis at pitrou.net> wrote: > >> I personally haven't written a lot of C, so have no personal experience, >> but if this is at all a common approach among experienced C developers, it >> tells us a lot. > > I think it's a matter of taste and personal habit. Some people will > often do it, some less. Note that C also has a tendency to make it > more useful, because doesn't have exceptions, so functions need to > (ab)use return values when they want to indicate an error. When you're > calling such functions (for example I/O functions), you routinely have > to check for special values indicating an error, so it's common to see > code such as: > > // Read up to n bytes from file descriptor > if ((bytes_read = read(fd, buf, n)) == -1) { > // Error occurred while reading, do something > } Thanks Antoine, this is an important point that I hope doesn't get lost. In a language with exceptions, assignment expressions are less needful. Also, the pattern of having of having mutating methods return None further limits the utility. Raymond
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4