Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code Unit Testing C Code

Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code

Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code

deleted 15 characters in body
Source Link
palacsint
  • 30.4k
  • 9
  • 82
  • 157

It looks fine. Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code

It looks fine. Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code

Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code

Source Link
palacsint
  • 30.4k
  • 9
  • 82
  • 157

It looks fine. Some ideas:

  1. I'd try encapsulating the position and mask parameters to one parameter. Maybe a struct would be fine for this. It is easy to mix up the parameters of ret, for example, somebody could call it accidentally with

     `ret(output, secondnum_pos, firstnum_mask)` 
    

or with

 `ret(output, firstnum_mask, firstnum_pos)`. 

(Note the parameter order.)

  1. Consider writing tests which store the i, j, k values in different order. Currently they do not detect if storing at the firstnum_pos overrides the second or the third values.

  2. Consider making copies of i, j and k for the assert calls before you call the marcos. If a macro accidentally changes values of i, j or k the assert will not detect it.

  3. A unit testing framework would be better for the testing: Unit Testing C Code

lang-c

AltStyle によって変換されたページ (->オリジナル) /