From b94ad5d8ae65795ba06e8f76819628db42b3554c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=2E=20R=C3=B8dseth?= Date: Sun, 21 Jan 2024 22:01:43 +0100 Subject: [PATCH] Remove all defines --- Makefile | 2 +- README.md | 2 ++ main.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b3c1c98..213d09b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: clean install test uninstall -CFLAGS ?= -std=c11 -O2 -pipe -fPIC -fno-plt -fstack-protector-strong -D_GNU_SOURCE -z norelro -Wall -Wextra -Wpedantic -Wfatal-errors +CFLAGS ?= -std=c2x -O2 -pipe -fPIC -fno-plt -fstack-protector-strong -D_GNU_SOURCE -z norelro -Wall -Wextra -Wpedantic -Wfatal-errors UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) CFLAGS := -std=c11 -O2 -pipe -fPIC -fstack-protector-strong -Wall -Wextra -Wpedantic -Wfatal-errors diff --git a/README.md b/README.md index a128db9..6a6b25e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Tested on Arch Linux and macOS, where it builds, runs and all tests pass. +A compiler that supports C23 / `-std=c2x` is required. + ### What is it, and what can it do? `xxd` or `tinyxxd` can be used to view binary or text files as hex codes. It is often installed on UNIX-like systems. It can dump files to hex, and also do the same thing in reverse: create files from hex codes. diff --git a/main.c b/main.c index f6b09d1..9786761 100644 --- a/main.c +++ b/main.c @@ -9,10 +9,10 @@ #include // Change this if more columns should ever be needed -#define COLS 256 +constexpr auto COLS = 256; // For static declarations of buffers -#define LLEN ((2 * (int)sizeof(unsigned long)) + 4 + (9 * COLS - 1) + COLS + 2) +constexpr auto LLEN = ((2 * (int)sizeof(unsigned long)) + 4 + (9 * COLS - 1) + COLS + 2); // HexType is the different hextypes known by this program enum HexType {