summaryrefslogtreecommitdiff
path: root/Examples/test-suite/default_arg_values.i
blob: 47ca2d12f09e27c8bf707216de154b0a4cae9446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
%module default_arg_values

%{
struct Display {
  // Some compilers warn about 'float v = NULL', so only SWIG sees this peculiarity
  // Bad Python wrappers were being generated when NULL used for primitive type
  float draw1(float v = 0) { return v; }
  float draw2(float *v = 0) { return v ? *v : 0; }
};
float* createPtr(float v) { static float val; val = v; return &val; }
%}

struct Display {
  // Bad Python wrappers were being generated when NULL used for primitive type
  float draw1(float v = NULL) { return v; }
  float draw2(float *v = NULL) { return v ? *v : 0; }
};
float* createPtr(float v) { static float val; val = v; return &val; }