Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible with "use:strict;" #27

Closed
viviparous opened this issue Jan 25, 2015 · 1 comment
Closed

incompatible with "use:strict;" #27

viviparous opened this issue Jan 25, 2015 · 1 comment

Comments

@viviparous
Copy link

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 viviparous changed the title incompatible with "uise:strict;" incompatible with "use:strict;" Jan 25, 2015
@mohawk2
Copy link
Collaborator

mohawk2 commented Jan 26, 2015

@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.

@mohawk2 mohawk2 closed this as completed Jan 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants