1. String::from("This is a pen");
2. "This is a pen".to_string();
3. let s: String = "This is a pen".into(); // type annotations needed
4. "This is a pen".to_owned();
5. format!("This is a pen");
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <time.h> | |
| #include "raylib.h" | |
| #ifdef _DEBUG | |
| #define WINDOW_TITLE "lifegame (debug)" | |
| #else | |
| #define WINDOW_TITLE "lifegame" | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.10) | |
| project(lifegame C) | |
| set(CMAKE_C_STANDARD_REQUIRED True) | |
| set(CMAKE_C_EXTENSIONS OFF) | |
| file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/src/*.c) | |
| add_executable(${PROJECT_NAME} ${SOURCES}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.10) | |
| # Debug build | |
| # $ cmake -S . -B build/debug -GNinja -DCMAKE_BUILD_TYPE=Debug | |
| # $ cmake --build build/debug -- basic_window && ./build/debug/basic_window.exe | |
| # Release build | |
| # $ cmake -S . -B build/release -GNinja -DCMAKE_BUILD_TYPE=Release | |
| # $ cmake --build build/release -- basic_window && ./build/release/basic_window.exe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| pub fn build(b: *std.Build) void { | |
| const target = b.standardTargetOptions(.{}); | |
| const optimize = b.standardOptimizeOption(.{}); | |
| const lib_mod = b.createModule(.{ | |
| .root_source_file = b.path("lib/mylib/mylib.zig"), | |
| .target = target, | |
| .optimize = optimize, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import std.stdio : writeln; | |
| import std.conv : to; | |
| import std.windows.charset : toMBSz; | |
| import core.sys.windows.windows : GetConsoleOutputCP; | |
| void main() | |
| { | |
| auto currentCodePage = GetConsoleOutputCP(); | |
| writeln(currentCodePage); |
cmake -E tar xf libxml2-xxx.tar.gz
cmake -S libxml2-xxx -B libxml2-xxx-build -D LIBXML2_WITH_PYTHON=OFF -D LIBXML2_WITH_ICONV=OFF -D LIBXML2_WITH_DEBUG=OFF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef UNICODE | |
| #define UNICODE | |
| #endif | |
| #include <stdio.h> | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <Windows.h> | |
| // types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| fn define_macros(raylib_module: *std.Build.Module) void { | |
| //------------------------------------------------------------------------------------ | |
| // Don't use the built in config.h | |
| //------------------------------------------------------------------------------------ | |
| raylib_module.addCMacro("EXTERNAL_CONFIG_FLAGS", "1"); |