diff --git a/.github/instructions/general.instructions.md b/.github/copilot-instructions.md similarity index 54% rename from .github/instructions/general.instructions.md rename to .github/copilot-instructions.md index 3efcf5d1d7e..e73eee50f6a 100644 --- a/.github/instructions/general.instructions.md +++ b/.github/copilot-instructions.md @@ -1,6 +1,3 @@ ---- -applyTo: "**" ---- # GitHub Copilot Instructions for HPCC Platform ## Repository Structure @@ -15,26 +12,19 @@ This repository contains **two distinct projects**: ### Build System - **Build tool**: CMake with Ninja generator - **Configuration**: Use options from `vcpkg-linux.code-workspace` -- **Key cmake arguments**: - ``` - -DCONTAINERIZED=OFF - -DUSE_OPTIONAL=OFF - -DUSE_CPPUNIT=ON - -DINCLUDE_PLUGINS=ON - -DSUPPRESS_V8EMBED=ON - -DSUPPRESS_REMBED=ON - ``` +- **Key cmake arguments**: deduce cmake arguments from .vscode/settings.json ### Build Commands +- **Build directory** (): Extract the current setting from "cmake.buildDirectory" in .vscode/settings.json which is based on $buildType ```bash # Configure the build -cmake -B ./build -S . -G Ninja -DCONTAINERIZED=OFF -DUSE_OPTIONAL=OFF -DUSE_CPPUNIT=ON -DINCLUDE_PLUGINS=ON -DSUPPRESS_V8EMBED=ON -DSUPPRESS_REMBED=ON -DCMAKE_BUILD_TYPE=Debug +cmake -B -S . -G Ninja -DCONTAINERIZED=OFF -DUSE_OPTIONAL=OFF -DUSE_CPPUNIT=ON -DINCLUDE_PLUGINS=ON -DSUPPRESS_V8EMBED=ON -DSUPPRESS_REMBED=ON -DCMAKE_BUILD_TYPE=Debug # Build -cmake --build ./build --parallel +cmake --build --parallel # Create package -cmake --build ./build --parallel --target package +cmake --build --parallel --target package ``` ### Key Directories @@ -53,6 +43,15 @@ cmake --build ./build --parallel --target package - Follow the style guide in `devdoc/StyleGuide.md` - Review guidelines in `devdoc/CodeReviews.md` - Submission process in `devdoc/CodeSubmissions.md` +- Never add trailing whitespace, be careful when copying code from other sources +- Use Allman style for C++ code blocks +- Do not use brace curly blocks for single line blocks, unless they are nested +- Use camel case for variable names +- Use constexpr's for constances not macros +- Use Owned vs Linked for assigning ownership of objects +- Avoid default parameters in function declarations (overload methods with different prototypes instead) +- Use `#pragma once` for header guards +- Use %u for unsigned integers, %d for signed integers ### Development Workflow - See `devdoc/Development.md` for testing and development guidelines @@ -66,3 +65,11 @@ For the ECL Watch web interface, see the separate instructions in `esp/src/.gith ## Documentation - Contributing docs: `devdoc/docs/ContributeDocs.md` - GitHub Copilot tips: `devdoc/userdoc/copilot/CopilotPromptTips.md` + +## When performing a code review +- Follow the guidelines in `devdoc/CodeReviews.md` +- Pay particular attention to the following questions: + - Are there any efficiency concerns? + - Is the code thread safe? + - Could the code be refactored to improve maintainability and reuse? + - Are there any memory or resource leaks? diff --git a/dali/daliadmin/daliadmin.cpp b/dali/daliadmin/daliadmin.cpp index 77614b01ecc..1b7719ab844 100644 --- a/dali/daliadmin/daliadmin.cpp +++ b/dali/daliadmin/daliadmin.cpp @@ -148,6 +148,31 @@ int main(int argc, const char* argv[]) return -1; } + unsigned *myvariablename = new unsigned; + *myvariablename = 10000; + printf("%d\n", *myvariablename); + + unsigned __int64 sum = 0; + // sum up all the numbers from 0 to 9999 + for (unsigned x=0; x<*myvariablename; x++) + { + sum += x; + } + printf("%llu\n", sum); + sum = 0; + // sum up all the numbers from 0 to 9999 N times + for (unsigned x=0; x<*myvariablename; x++) + { + for (unsigned y=0; y<*myvariablename; y++) + { + // nested loop + sum += x; + } + } + printf("%llu\n", sum); + + + Owned globals = loadConfiguration(defaultYaml, argv, "daliadmin", "DALIADMIN", "daliadmin.xml", nullptr, nullptr, false); Owned props = createProperties("daliadmin.ini"); StringArray params; diff --git a/devdoc/StyleGuide.md b/devdoc/StyleGuide.md index 2c1dd9a89cd..ef769cbcd4b 100644 --- a/devdoc/StyleGuide.md +++ b/devdoc/StyleGuide.md @@ -358,3 +358,5 @@ MORE! Requiring more work: \* namespaces \* STL \* c++11 \* Review all documentation \* Better examples for shared + +