# NOT RUN {
example <- function(file){
filepath <- system.file("cppexamples", file, package = "cppcheckR")
lines <- readLines(filepath)
print(cppcheckR(filepath, std = "c++03", def = NA, undef = NA))
message(file, ":")
cat(paste0(format(seq_along(lines)), ". ", lines), sep = "\n")
}
example("memleak.cpp")
example("outofbounds.cpp")
example("unusedvar.cpp")
example("useless.cpp")
# }
Run the code above in your browser using DataLab