radmedres / clmedview

An attempt to create a cross-platform medical image viewer specialized in drawing "regions of interests".
GNU General Public License v3.0
3 stars 2 forks source link

Coding standard. #35

Open minovations opened 9 years ago

minovations commented 9 years ago

I want to discuss the coding standard in clmedview. It happens to much that wrong types are mixed and that code won't work. A little example

  serie *active_serie = CONFIGURATION_ACTIVE_MASK_SERIE (config);
  if (active_serie == NULL) return;

  List *viewers = list_nth (pll_Viewers, 1);
  while (viewers != NULL)
  {
    viewer_set_lookup_table_for_serie (viewers->data, active_serie, lut_name);
    viewers = viewers->next;
  }

This looks alright, but "CONFIGURATION_ACTIVE_MASK_SERIE" is returning a tree pointer and not a serie pointer.

Therefore I want to create a convention of naming functions, types, variables, macros. If someone has a proposal, please let me know.

roelj commented 9 years ago

I think it is wrong for CONFIGURATION_ACTIVE_MASK_SERIE to provide a Tree pointer. The macro implies a Serie and not a Tree.

Where is it set to a Tree pointer? I can't find any occurrence.

As for a coding standard. I'd like to see a namespaced standard like:

{Library name without "lib" prefix}_{function name} ();

Example:

viewer_set_active_layer ();  // Located in libviewer
memory_load_file ();         // Located in libmemory