|There is this function in gestremer matroska demux plugin:
gboolean
gst_matroska_demux_plugin_init (GstPlugin * plugin)
{
/* parser helper separate debug */
GST_DEBUG_CATEGORY_INIT (ebmlread_debug, "ebmlread",
0, "EBML stream helper class");
/* create an elementfactory for the matroska_demux element */
if (!gst_element_register (plugin, "matroskademux",
GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX))
return FALSE;
return TRUE;
}
Now gst_element_register()
is type of
gboolean gst_element_register (GstPlugin *plugin,
const gchar *name,
guint rank,
GType type);
Returns :
TRUE, if the registering succeeded, FALSE on error
Then why not write it in the following way?
gboolean
gst_matroska_demux_plugin_init (GstPlugin * plugin)
{
/* parser helper separate debug */
GST_DEBUG_CATEGORY_INIT (ebmlread_debug, "ebmlread",
0, "EBML stream helper class");
/* create an elementfactory for the matroska_demux element */
return gst_element_register (plugin, "matroskademux",
GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX))
}
Coding standards help in the development of software programs that are less complex and thereby reduce the errors. If programming standards in software engineering are followed, the code is consistent and can be easily maintained. This is because anyone can understand it and can modify it at any point in time.
Some general advice on good coding styleGood code is self-explanatory – the need for comments should be minimal. Comments should be added to those parts of the code where explanations are needed. With code one should not be clever if it is not necessary – do things in an obvious straightforward way.
Coding style is extremely personal and everyone has their own preferred style. You can discover your own personal style by looking back over code that you've written when you didn't have a style guide to adhere to.
It's part of a pattern.
if (!some_function(...))
return false;
if (!other_function(...))
return false;
return true;
Whoever wrote it decided not to change the pattern just because there's only one function call. Ultimately it's a matter of taste.
As such there is no problem with the code. At least I wont penalize if anyone uses any of the mentioned snippets.
These are the reasons that I think are the cause:
Conclusion is what I said in the beginning. It does not matter as long as code is easy to understand. Regarding some optimization gains, I think for this compilers are intelligent enough to take care.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With