Skip to content

Code Sample General Criteria

Wei, Jimmy T edited this page Mar 10, 2023 · 1 revision

Samples are created for a reason

  • Samples demonstrate:​

    • A language or library feature​
    • An optimization strategy​
    • Tool usages​
  • Samples should:​

    • Illustrate DPC++ so the less non-DPC++ code the better​
    • DPC++ by default is C++17, do not enforce older variants
    • Samples should be coded using DPC++ idioms and not directly use DPCT runtime functions unless demonstrating a DPCT workflow.
    • Be short, simple, clean, beautiful, and understandable​
    • Be usable in presentations or tutorials​
    • Build on other samples, so users gain knowledge​
    • Minimize the number of concepts the user needs to learn​
    • Use real-world algorithms when possible​
  • Samples for a toolkit should represent the segment each toolkit targets

  • Sample code should be well explained through the use of comments when C++ features are used beyond the following concepts:

    • C subset of C++
    • Using Standard Libraries, such as
      • std:: iostreams​
      • std:: containers (vector, array)​
      • std:: chrono (timing)​
    • Class definitions​ - Constructors, Destructors, Methods​
    • Namespaces​
    • References​
    • Exceptions
Clone this wiki locally