You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DIE macro functionally provides a way to handle critical errors that mostly duplicates the functionality of assert.
Simple error handling may be appropriate for extremely basic applications, but more complex applications should handle errors internally and attempt to recover from them. For example, the inability to bind to a port is likely fatal for the server (as the server would be unable to function), but being unable to communicate with the client (e.g. if the client had closed its socket), is not fatal. Some demos (e.g., network_stream_socket_server.c and unix_stream_socket_client.c) handle all errors as critical (including accept and read/write operations), which should not be a common practice.
I think that the use of the DIE macro should be more limited, and likely replaced with assert statements even when its use is warranted.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The DIE macro functionally provides a way to handle critical errors that mostly duplicates the functionality of
assert
.Simple error handling may be appropriate for extremely basic applications, but more complex applications should handle errors internally and attempt to recover from them. For example, the inability to bind to a port is likely fatal for the server (as the server would be unable to function), but being unable to communicate with the client (e.g. if the client had closed its socket), is not fatal. Some demos (e.g., network_stream_socket_server.c and unix_stream_socket_client.c) handle all errors as critical (including
accept
andread
/write
operations), which should not be a common practice.I think that the use of the
DIE
macro should be more limited, and likely replaced withassert
statements even when its use is warranted.Beta Was this translation helpful? Give feedback.
All reactions