The benchmark provides a simple implementation of a utility that prints the contents of a file given by two C strings that store the directory the file is located in and the base name of that file. The lengths of the strings are given as separate arguments.
+
The benchmark provides a simple implementation of a utility that prints the contents of a file given by two C strings that store the directory the file is located in, and the base name of that file. The lengths of the strings are given as separate arguments.
−
The scenario explored by this example is as follows. The strings representing a directory and a file name are concatenated in a fixed-size buffer. The concatenation is guarded by a conditional statement that adds the lengths of the strings and immediately returns if the sum of of the lengths is greater than the size of the buffer. The aim of the guard is to prevent writing past the bounds of the fixed-size buffer.
+
The scenario explored by this benchmark is as follows. The strings representing a directory and a file name are concatenated in a fixed-size buffer. The concatenation is guarded by a conditional statement that adds the lengths of the strings and immediately returns if the sum of of the lengths is greater than the size of the buffer. The aim of the guard is to prevent writing past the bounds of the fixed-size buffer.