in reply to Re^7: Rosetta Code: Long List is Long (faster - vec - OpenMP)
in thread Rosetta Code: Long List is Long

It was weird experiencing the segfault due to strtok(NULL, "\n").

Great! What is strtok_r() function in C language? I compared strtok_r with context against strchr. After testing, I updated the OpenMP demonstration to find the tab character within the string. Now passing: limited length and variable length words, including OpenMP. Update 2 enables parallel sort.

# 15 input files, 1 thread, clang++ -std=c++20 strtok_r 9.655 seconds strchr 8.713 seconds
while ( ::fgets(line, MAX_LINE_LEN_L, fh) != NULL ) { found = ::strchr(line, '\t'); count = ::atoll( &line[found - line + 1] ); line[found - line] = '\0'; // word ... }

Also, I replaced strlen(...) with found - line.

::memcpy( fixword.data(), line, found - line );