No announcement yet.

Whitespace importance in C/C++ compare

  • Filter
  • Time
  • Show
Clear All
new posts

  • Whitespace importance in C/C++ compare

    I'm running into an issue in which whitespace differences are being considered important by BC (Version 4.2.9 (build 23626) on Linux).

    Specifically, line breaks in code that change (usually as a result of ClangFormat).

    For example, see the attached photo. The only differences are the changes in whitespace, yet BC is treating these as important differences. The rules I'm using are the default ones.

    I tried editing the rules and adding whitespace regex ("\s") to the unimportant text section, but BC immediately segfaults.

    Please help.

  • #2

    In BC4, line breaks are always important. The grammar definitions for whitespace are within aligned pairs of lines. To perform this style of comparison, you would need to pre-process your files with a tidy process that normalizes the line breaks. We do not have a C++ syntax tidy format, but have a few examples you can compare against, here:
    with a guide for creating a custom format here:

    As for the segfault, are you using the Text Compare's Session menu -> Session Settings, Importance tab, and defined in the Unimportant section a new Regular Expression that matches \s? I'm not seeing the same crash, but if you can email in your (Help menu -> Support; Export), the steps you are following, and the crash log, to we can look into this. Please also include a link to this forum thread for our reference.
    Aaron P Scooter Software