Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions docs/c++/cpp-basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// ...existing code...
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the placeholder comment '// ...existing code...' on line 1. This is a comment artifact that doesn't belong in a new file and adds no value to the documentation.

Suggested change
// ...existing code...

Copilot uses AI. Check for mistakes.
# C++ Tech Stack

Brief, practical tech stack and examples for modern C++ projects (aligned with CONTRIBUTING.md style).

## What is this tech stack?
A curated set of compilers, build tools, libraries, testing and CI tools commonly used for developing reliable, cross-platform C++ applications and libraries.

## Core Components

- Compilers
- GCC (g++)
- Clang (clang++)
- MSVC (cl.exe) β€” Windows
- Build systems
- CMake (recommended)
- Meson, Bazel (alternatives)
- Package managers
- Conan, vcpkg
- Testing
- Catch2, GoogleTest
- Formatting & linting
- clang-format, clang-tidy
- Debugging & profiling
- gdb, lldb, Visual Studio Debugger, valgrind, perf
- Static analysis
- cppcheck, clang-tidy, clang-analyzer
- CI/CD
- GitHub Actions, GitLab CI, Azure Pipelines
- IDEs & Editors
- Visual Studio Code (with C/C++ extension), CLion, Visual Studio, Qt Creator

## Basic Example

Hello world (file: src/main.cpp)
```cpp
#include <iostream>

int main() {
std::cout << "Hello, C++ tech stack!\n";
return 0;
}
```
Expected output:
```
Hello, C++ tech stack!
```

## Minimal CMakeLists.txt
```cmake
cmake_minimum_required(VERSION 3.16)
project(hello_cpp LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
add_executable(hello src/main.cpp)
```

## Example unit test (Catch2)
```cpp
// tests/test_example.cpp
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>

int add(int a, int b) { return a + b; }

TEST_CASE("addition works") {
REQUIRE(add(2,3) == 5);
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after the comma in the function call. It should be 'add(2, 3)' to follow C++ formatting conventions and improve readability.

Suggested change
REQUIRE(add(2,3) == 5);
REQUIRE(add(2, 3) == 5);

Copilot uses AI. Check for mistakes.
}
```

## CI snippet (GitHub Actions - build & test)
```yaml
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc, clang]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential cmake
- name: Configure
run: cmake -S . -B build
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest --test-dir build --output-on-failure
```

## File organization
```
project/
β”œβ”€ src/
β”‚ └─ main.cpp
β”œβ”€ include/
β”‚ └─ project/
β”œβ”€ tests/
β”‚ └─ test_example.cpp
β”œβ”€ CMakeLists.txt
└─ .github/workflows/ci.yml
```

## Common Pitfalls
- Undefined behavior (use sanitizers: -fsanitize=address,undefined,leak)
- Mixing ABIs or incompatible compiler flags
- Missing header guards / pragma once issues
- Manual memory mistakes β€” prefer smart pointers and RAII

## Best Practices
- Use modern C++ (RAII, smart pointers, move semantics, constexpr, spans)
- Keep headers minimal; prefer pimpl or modules for large projects
- Enforce style with clang-format and checks in CI
- Write unit tests and run sanitizers in CI
- Use CMake modern targets and interface libraries (target_include_directories / target_compile_features)

## Related Topics
- C++ core guidelines β€” https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
- CMake documentation β€” https://cmake.org/documentation/
- Conan β€” https://conan.io
- Catch2 β€” https://github.com/catchorg/Catch2

## References
- cppreference: https://en.cppreference.com
- Sanitizers & Undefined Behavior: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
124 changes: 124 additions & 0 deletions docs/c-sharp/c-sharp-basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# C# Tech Stack

Brief, practical tech stack and examples for modern C#/.NET projects (aligned with CONTRIBUTING.md style).

## What is this tech stack?
A concise set of SDKs, frameworks, tools and practices for building cross-platform .NET applications: web, APIs, libraries, and CLI tools.

## Core Components
- Runtime / SDK
- .NET SDK (dotnet 6, 7, 8+)
- Frameworks
- ASP.NET Core, MAUI, Blazor
- Build & tooling
- dotnet CLI, MSBuild
- Package manager
- NuGet
- Testing
- xUnit, NUnit, MSTest
- Formatting & linting
- dotnet format, StyleCop.Analyzers, EditorConfig
- Debugging & profiling
- Visual Studio debugger, dotnet-trace, dotnet-counters, JetBrains dotTrace
- Static analysis
- Roslyn analyzers, SonarQube
- CI/CD
- GitHub Actions, Azure Pipelines, GitLab CI
- IDEs
- Visual Studio, VS Code (C# extension), Rider

## Basic Example

Program.cs
```csharp
using System;

class Program {
static void Main() {
Console.WriteLine("Hello, .NET!");
}
}
```
Expected output:
```
Hello, .NET!
```

## Minimal .csproj
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
```

## Example unit test (xUnit)
```csharp
// tests/CalculatorTests.cs
using Xunit;

public class Calculator {
public int Add(int a,int b) => a + b;
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after the comma in the parameter list. The method signature should be 'Add(int a, int b)' to follow C# formatting conventions and improve readability.

Suggested change
public int Add(int a,int b) => a + b;
public int Add(int a, int b) => a + b;

Copilot uses AI. Check for mistakes.
}

public class CalculatorTests {
[Fact]
public void Add_Works() {
var c = new Calculator();
Assert.Equal(5, c.Add(2,3));
}
}
```

## CI snippet (GitHub Actions)
```yaml
name: .NET CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- run: dotnet restore
- run: dotnet build --configuration Release --no-restore
- run: dotnet test --no-build --verbosity normal
```

## File organization
```
project/
β”œβ”€ src/
β”‚ └─ ProjectName/
β”‚ β”œβ”€ Program.cs
β”‚ └─ ProjectName.csproj
β”œβ”€ tests/
β”‚ └─ ProjectName.Tests/
β”œβ”€ .github/workflows/
└─ README.md
```

## Common Pitfalls
- Mixing target frameworks or incompatible package versions
- Ignoring nullable reference warnings
- Heavy synchronous I/O on ASP.NET threads
- Leaking DI scopes or disposing shared services

## Best Practices
- Prefer async/await for I/O
- Use DI and small services
- Enable analyzers and treat warnings as errors in CI
- Pin package versions for libraries
- Write unit and integration tests; run them in CI

## Related Topics
- ASP.NET Core Docs β€” https://learn.microsoft.com/aspnet/core
- .NET API Browser β€” https://learn.microsoft.com/dotnet/api

## References
- https://dotnet.microsoft.com
- xUnit: https://xunit.net
Loading