News for hackers. Stuff that matters.
Re:How to Structure C Projects: These Best Practices Worked ... by colonwqbang on Friday March 08, 2024 @09:27AM (#39641308)
Your problems are not with C the language but with the chosen build tools. Have you tried using a more modern tool like Meson? It is more comparable to Cargo.

To start a new project today using plain GNU Make like the author of the article recommends, is not a good idea unless you enjoy fiddling with the build.

Re:How to Structure C Projects: These Best Practices Worked ... by flykespice on Friday March 08, 2024 @09:38AM (#39641424)
> Have you tried using a more modern tool like Meson? It is more comparable to Cargo.

Not comparable at all.

The difference is Cargo is the official standard package manager of the Rust language. Meson is one among the sea of incompatible build systems for the C language.

Re:How to Structure C Projects: These Best Practices Worked ... by tialaramex on Friday March 08, 2024 @10:29AM (#39641917)
Right, crucially cargo is in the box with your Rust compiler, you have to go out of your way to have just the actual Rust compiler but not cargo.

As with the lesson gofmt taught, you must supply the basic feature in the box. Humans are lazy, so if it doesn't come in the box only people who know they can't live without it will even bother, put it in the box and only people who can't live with it will remove it.

Re:How to Structure C Projects: These Best Practices Worked ... by binary132 on Friday March 08, 2024 @09:43AM (#39641470)
That's why we need a new build system / package manager for C. /s (but not really)
Re:How to Structure C Projects: These Best Practices Worked ... by funnyflywheel on Friday March 08, 2024 @09:50AM (#39641533)
https://xkcd.com/927 comes to mind.
Re:How to Structure C Projects: These Best Practices Worked ... by binary132 on Friday March 08, 2024 @01:20PM (#39644110)
Yeah, that's the joke. But I mean, you have to admit the status quo isn't that good. Something really very much better might be able to claw its way to the top.
Re:How to Structure C Projects: These Best Practices Worked ... by keybored on Friday March 08, 2024 @02:14PM (#39644954)
Please perish the thought.
Re:How to Structure C Projects: These Best Practices Worked ... by humanrebar on Friday March 08, 2024 @01:10PM (#39643953)
But C ships to all sorts of places, so why would C limit its options by limiting its support to its own package manager?
Re:How to Structure C Projects: These Best Practices Worked ... by kerkeslager on Friday March 08, 2024 @04:00PM (#39646416)
How would having a builtin build system (I'm not even asking for a package manager) limit where C can ship to?
Re:How to Structure C Projects: These Best Practices Worked ... by jjgreen on Friday March 08, 2024 @11:12AM (#39642467)
With make, you don't have to install anything, it's POSIX
Re:How to Structure C Projects: These Best Practices Worked ... by yjftsjthsd-h on Friday March 08, 2024 @02:09PM (#39644876)
Being POSIX doesn't mean it's included by default; for example, you can start with the default installation of debian, install a compiler, and still not have make installed
Re:How to Structure C Projects: These Best Practices Worked ... by kerkeslager on Friday March 08, 2024 @04:06PM (#39646501)
This technically isn't true, but I'll give you the point because I don't see `sudo apt install build-essentials` as a significant barrier to entry.

But being able to print "make: ** No targets specified and no makefile found. Stop." to stderr isn't particularly useful, and having to write a Makefile is a significant barrier.

Re:How to Structure C Projects: These Best Practices Worked ... by kerkeslager on Friday March 08, 2024 @03:11PM (#39645762)
> Your problems are not with C the language but with the chosen build tools.

That's not a distinction I care about. The tooling around a language should be a part of discussing the merits of a language. Your language can be the most ergonomic language in the world, but if all your development gains are lost fiddling with build tools, you haven't gained anything.

> Have you tried using a more modern tool like Meson?

I haven't, but now that I know about it, I'll give it a try. Thanks for the info! It looks promising.

> To start a new project today using plain GNU Make like the author of the article recommends, is not a good idea unless you enjoy fiddling with the build.

Maybe, but that just brings up the problem that there isn't really a clear second-tier system outside the standard library for tools. Certain tools (i.e. Valgrind) are well-known, but there are a million different ways to install a million different tools and for most things it's ultimately more common to just roll your own.