daoswald/Inline-CPP

incompatible with "use:strict;"

Closed this issue · 1 comments

The following example fails to compile because of the "use strict" statement. Comment the line and the example will work.

#! /usr/bin/perl -w

use strict;

use Inline CPP;

print "9 + 16 = ", add(9, 16), "\n";
print "9 - 16 = ", subtract(9, 16), "\n";

__END__
__CPP__

int add(int x, int y) {
  return x + y;
}

int subtract(int x, int y) {
  return x - y;
}

@viviparous, I took the liberty of editing your comment above to add the Markdown tags for verbatim code.

This is a straightforward Perl programming error on your part. If you replace Inline above with strict, you will see the same. You are trying to treat CPP as a special thing, whereas without strict it is simply a bareword which is interpreted as the string 'CPP'. If you put quotes around CPP above, it works fine.