Skip to content

Instantly share code, notes, and snippets.

@Xliff
Last active April 25, 2016 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xliff/54c7b2f1661b8f56beb8b1b1b6c1bc87 to your computer and use it in GitHub Desktop.
Save Xliff/54c7b2f1661b8f56beb8b1b1b6c1bc87 to your computer and use it in GitHub Desktop.

If you are trying to figure out a safe way to port C-code resembling this to perl6:

char **ptr=vc.user_comments;
while(*ptr){
    fprintf(stderr,"%s\n",*ptr);
    ++ptr;
}

Something simlar to this will do the trick:

my @uc := nativecast(CArray[Str], $vc.user_comments);
loop (my $ci = 0; @uc[$ci].defined; $ci++) {
        diag "Comment: {@uc[$ci]}";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment