top | item 39642796

(no title)

LabMechanic | 2 years ago

Use MinUnit.h

https://jera.com/techinfo/jtns/jtn002

Consider using Clang-Tidy with

  `-*,cert-*`
(Which disables all default options, and checks your code according to the Secure coding standard (CERT) ruleset.)

Use Clang-Format as well. If you use Clang, consider `-Weverything -fsanitize=address,undefined` and disable options that you do not need. Consider using NMake or Make (or just write a simple script to automate building the stuff).

Here's a Google-esque style guide for C:

https://gist.github.com/davidzchen/9187878

At least, this is my approach.

discuss

order

LabMechanic|2 years ago

Here's a simple NMAKE Makefile using MSVC to compile a Win32 application on Windows 11:

  CC = cl.exe
  LD = link.exe
  CFLAGS =  /Od /Zi /FAsu /std:c17 /permissive- /W4 /WX
  LDFLAGS = /DEBUG /MACHINE:X64 /ENTRY:wWinMainCRTStartup /SUBSYSTEM:WINDOWS
  LDLIBS = user32.lib gdi32.lib
  PREFIX = ../src/

  all: app.exe

  app.exe: app.obj
  $(LD) $(LDFLAGS) /OUT:app.exe app.obj $(LDLIBS)

  app.obj: $(PREFIX)app.c
  $(CC) /c $(CFLAGS) $(PREFIX)app.c

  clean:
   rmdir /q /s build