Giter VIP home page Giter VIP logo

ccvector's People

Contributors

jobtalle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ccvector's Issues

Divisions by 0

Hi, I just had a look at your project (from stb) and noticed that there are a few possible divisions by 0.

In _CCV_FUNC_MAT_INVERSE if the matrices are not invertible, the determinant will be 0 and therefore 1 / det is not computable.

Also for _CCV_FUNC_MAT_PERSPECTIVE if the user gives unappropriated values, such as angle = 0, aspect = 0 or zNear = zFar, it will lead to other divisions by 0 and therefore a crash.

While giving wrong arguments for _CCV_FUNC_MAT_PERSPECTIVE can be easily avoided by the user, I think it would be better to add asserts.

Just my two cents.

Lots of warnings with ISO C99 -Wpedantic

This is a notable library on Sean's list, so I'm sure it is tested thoroughly. Nonetheless, when I compile it via GCC with the below options, I get a whole bunch of warnings.

gcc -std=c99 -Wall -Wextra -Wpedantic -O2 -o main src/main.c -Iinclude -lm
In file included from src/main.c:10:0:
include/ccVector.h:387:26: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  struct { ccvType x, y; };
                          ^
include/ccVector.h:395:29: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
     struct { ccvType x, y; };
                             ^
include/ccVector.h:398:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
     };
      ^
include/ccVector.h:394:4: warning: union has no named members [-Wpedantic]
    union {
    ^~~~~
include/ccVector.h:399:5: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
    };
     ^
include/ccVector.h:401:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   };
    ^
include/ccVector.h:405:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   };
    ^
include/ccVector.h:392:2: warning: union has no named members [-Wpedantic]
  union {
  ^~~~~
include/ccVector.h:406:3: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  };
   ^
include/ccVector.h:416:31: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
       struct { ccvType x, y; };
                               ^
include/ccVector.h:418:7: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
      };
       ^
include/ccVector.h:420:31: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
       struct { ccvType z, w; };
                               ^
include/ccVector.h:422:7: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
      };
       ^
include/ccVector.h:414:5: warning: struct has no named members [-Wpedantic]
     struct {
     ^~~~~~
include/ccVector.h:423:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
     };
      ^
include/ccVector.h:428:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
     };
      ^
include/ccVector.h:413:4: warning: union has no named members [-Wpedantic]
    union {
    ^~~~~
include/ccVector.h:429:5: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
    };
     ^
include/ccVector.h:412:3: warning: struct has no named members [-Wpedantic]
   struct {
   ^~~~~~
include/ccVector.h:430:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   };
    ^
include/ccVector.h:436:7: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
      };
       ^
include/ccVector.h:438:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
     };
      ^
include/ccVector.h:442:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
     };
      ^
include/ccVector.h:432:4: warning: union has no named members [-Wpedantic]
    union {
    ^~~~~
include/ccVector.h:443:5: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
    };
     ^
include/ccVector.h:431:3: warning: struct has no named members [-Wpedantic]
   struct {
   ^~~~~~
include/ccVector.h:444:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   };
    ^
include/ccVector.h:411:2: warning: union has no named members [-Wpedantic]
  union {
  ^~~~~
include/ccVector.h:445:3: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  };
   ^
In file included from src/main.c:10:0:
include/ccVector.h: In function ‘mat2x2Rotate’:
include/ccVector.h:63:31: warning: pointers to arrays with different qualifiers are incompatible in ISO C [-Wpedantic]
 #define CCV_MAT_TYPENAME(dim) mat##dim##x##dim
                               ^
include/ccVector.h:42:21: note: in definition of macro ‘CAT2_’
 #define CAT2_(a, b) a##b
                     ^
include/ccVector.h:97:43: note: in expansion of macro ‘CAT2’
 #define CCV_FUNC_MAT_COPY(dim)            CAT2(CCV_MAT_TYPENAME(dim), Copy)
                                           ^~~~
include/ccVector.h:97:48: note: in expansion of macro ‘CCV_MAT_TYPENAME’
 #define CCV_FUNC_MAT_COPY(dim)            CAT2(CCV_MAT_TYPENAME(dim), Copy)
                                                ^~~~~~~~~~~~~~~~
include/ccVector.h:476:2: note: in expansion of macro ‘CCV_FUNC_MAT_COPY’
  CCV_FUNC_MAT_COPY(dim)(buffer, m); \
  ^~~~~~~~~~~~~~~~~
include/ccVector.h:631:83: note: in expansion of macro ‘CCV_APPLY_MATRIX’
 static inline void CCV_FUNC_MAT_ROTATE(2)(CCV_MAT_TYPENAME(2) m, const ccvType r) CCV_APPLY_MATRIX(2, CCV_FUNC_MAT_SET_ROTATION(2)(multiply, r));
                                                                                   ^~~~~~~~~~~~~~~~
include/ccVector.h:63:31: warning: pointers to arrays with different qualifiers are incompatible in ISO C [-Wpedantic]
 #define CCV_MAT_TYPENAME(dim) mat##dim##x##dim
                               ^
include/ccVector.h:42:21: note: in definition of macro ‘CAT2_’
 #define CAT2_(a, b) a##b
                     ^
include/ccVector.h:101:43: note: in expansion of macro ‘CAT2’
 #define CCV_FUNC_MAT_MULTIPLY_MATRIX(dim) CAT2(CCV_MAT_TYPENAME(dim), MultiplyMatrix)
                                           ^~~~
include/ccVector.h:101:48: note: in expansion of macro ‘CCV_MAT_TYPENAME’
 #define CCV_FUNC_MAT_MULTIPLY_MATRIX(dim) CAT2(CCV_MAT_TYPENAME(dim), MultiplyMatrix)
                                                ^~~~~~~~~~~~~~~~
include/ccVector.h:477:2: note: in expansion of macro ‘CCV_FUNC_MAT_MULTIPLY_MATRIX’
  CCV_FUNC_MAT_MULTIPLY_MATRIX(dim)(m, buffer, multiply); \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/ccVector.h:631:83: note: in expansion of macro ‘CCV_APPLY_MATRIX’
 static inline void CCV_FUNC_MAT_ROTATE(2)(CCV_MAT_TYPENAME(2) m, const ccvType r) CCV_APPLY_MATRIX(2, CCV_FUNC_MAT_SET_ROTATION(2)(multiply, r));

etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.