PageRenderTime 46ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/default_arg_values.i

#
Swig | 18 lines | 16 code | 2 blank | 0 comment | 0 complexity | 0d4b67fc738c04bd24605656f4c374d6 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module default_arg_values
  2. %{
  3. struct Display {
  4. // Some compilers warn about 'float v = NULL', so only SWIG sees this peculiarity
  5. // Bad Python wrappers were being generated when NULL used for primitive type
  6. float draw1(float v = 0) { return v; }
  7. float draw2(float *v = 0) { return v ? *v : 0; }
  8. };
  9. float* createPtr(float v) { static float val; val = v; return &val; }
  10. %}
  11. struct Display {
  12. // Bad Python wrappers were being generated when NULL used for primitive type
  13. float draw1(float v = NULL) { return v; }
  14. float draw2(float *v = NULL) { return v ? *v : 0; }
  15. };
  16. float* createPtr(float v) { static float val; val = v; return &val; }