17
Write Free Software Community (discourse.writefreesoftware.org)
submitted 2 weeks ago* (last edited 2 weeks ago) by modev@programming.dev to c/opensource@programming.dev

"This community exists to support people in their free software journeys. If you have questions about how a particular license works, or which to choose for your project, how to re-use software, advice on managing a healthy community, and so on, this is the place for you."

7
[-] modev@programming.dev 2 points 3 months ago

Thank you. That's what most of developers need to realize.

[-] modev@programming.dev 3 points 3 months ago

Agreed. Teams are a powerful option.

[-] modev@programming.dev 2 points 3 months ago

I am working at same company almost 20 yers and yes I burned out several times. I have sport, healthy food and hobbies like learning new tech. These 3 things are enough for me.

13

Nowadays, many people strive to conquer the heights of programming in one language or another. There are debates about which language is better, which is more productive, many developers and beginners focus on benchmarks and foam at the mouth to prove something to each other. This is so childish and so pointless!

Ask yourself the question, what will you create using this or that language? Do you have a startup idea? Can you create something new? Remake an existing one, but make it 10 times better?

If you are offered a job or take tests and interviews, you will be given technologies that you will be required to use. Business, money, and interests of managers who have never written code themselves will carry more weight than the results of your research and study of effective programming languages. This is the fucking reality of the industry today!

Therefore, you need to learn something else: physics, mathematics, chemistry, neurobiology, any natural science. This will give you the opportunity to write something in your favorite programming languages that someone else really needs. Not boring schedules and product lists, mailings and stores, fuck commerce.

Natural on, that's what should advance your programming knowledge!

9
Burnout or not to burnout (programming.dev)

When I come across such infographics with tips, I sometimes wonder, if you follow all these tips, then where will you find the time to program? Of course, all this is useful, but every developer knows how much you want to get done with all public affairs and immerse yourself in the code, especially if it is the code of a project that you love. And on the contrary, if you have to write a rotten project, with a stupid team, while working for a mercantile scumbag, no matter what you do, you will be sick of work. What is the conclusion here? Either you do what you love; or love what you do. And you will have much more free time. What about burnout? We are all phoenixes...

23

Almost 50 years ago, the C language defined modern computer programming. This book shows you why C is still as powerful and popular as ever, with an inside look at the new C23 standard.

For programs that need to be small, fast, and unfailingly reliable, C is still the gold standard. Whether you’re writing embedded code, low-level system routines, or high-performance applications, C is up to the challenge. This unique book by Jens Gustedt, a member of the ISO C standards committee, gets you up to speed with C23.

In Modern C, Third Edition you’ll:

  • Learn C basics, core features, and advanced concepts
  • Leverage major C23 improvements for security, reliability, and performance
  • Write portable code that runs anywhere
  • Build multi-threaded applications with atomics and synchronization
  • Create robust and resilient software with error handling
  • Use type-generic programming for reusable code

C powers more software than any other language — from embedded devices to distributed systems. In Modern C, Third Edition you’ll learn to harness C’s full potential using the latest tools and techniques. After a quick review of the fundamentals perfect for beginners or coders who haven’t used C in a while, this book guides you to mastery of C23, the latest ISO standard.

81
Rust coin (programming.dev)

Rust coin must exist, otherwise what is the Rust compiler mining in the background?

[-] modev@programming.dev 3 points 4 months ago

Interesting, if you subscribed to the C lang community and downvote posts that support C... Who are you? Rust agents? 😁

-4
submitted 4 months ago* (last edited 4 months ago) by modev@programming.dev to c/c_lang@programming.dev

Maybe you have to hear about this.

What do you think?

I think:

C will never die

For infrastructure technology, C will be hard to displace. © Dennis Ritchie

[-] modev@programming.dev 2 points 4 months ago

Read about platform support, and faq. You should prefer custom installation, example for FreeBSD.

And are you rustacean?

17

Developers struggle with C pointers because they do not feel confident. I found a very good book about it: Understanding and Using C Pointers by Richard Reese.

"Why You Should Become Proficient with Pointers

Pointers have several uses, including:

  • Creating fast and efficient code
  • Providing a convenient means for addressing many types of problems
  • Supporting dynamic memory allocation
  • Making expressions compact and succinct
  • Providing the ability to pass data structures by pointer without incurring a large overhead
  • Protecting data passed as a parameter to a function

Faster and more efficient code can be written because pointers are closer to the hardware.

That is, the compiler can more easily translate the operation into machine code. There is not as much overhead associated with pointers as might be present with other operators.

Many data structures are more easily implemented using pointers. For example, a linked list could be supported using either arrays or pointers.

However, pointers are easier to use and map directly to a next or previous link. An array implementation requires array indexes that are not as intuitive or as flexible as pointers."

"A solid understanding of pointers and the ability to effectively use them separates a novice C programmer from a more experienced one. Pointers pervade the language and provide much of its flexibility. They provide important support for dynamic memory allocation, are closely tied to array notation, and, when used to point to functions, add another dimension to flow control in a program.

Pointers have long been a stumbling block in learning C. The basic concept of a pointer is simple: it is a variable that stores the address of a memory location. The concept, however, quickly becomes complicated when we start applying pointer operators and try to discern their often cryptic notations. But this does not have to be the case. If we start simple and establish a firm foundation, then the advanced uses of pointers are not hard to follow and apply.

The key to comprehending pointers is understanding how memory is managed in a C program. After all, pointers contain addresses in memory. If we don’t understand how memory is organized and managed, it is difficult to understand how pointers work. To address this concern, the organization of memory is illustrated whenever it is useful to explain a pointer concept. Once you have a firm grasp of memory and the ways it can be organized, understanding pointers becomes a lot easier."


Good explanation about "Differences Between Arrays and Pointers"

There are several differences between the use of arrays and the use of pointers to arrays. In this section, we will use the vector array and pv pointer as defined below:

int vector[5] = {1, 2, 3, 4, 5};
int *pv = vector;

The code generated by vector[i] is different from the code generated by vector+i. The notation vector[i] generates machine code that starts at location vector, moves i positions from this location, and uses its content. The notation vector+i generates machine code that starts at location vector, adds i to the address, and then uses the contents at that address. While the result is the same, the generated machine code is different. This difference is rarely of significance to most programmers. There is a difference when the sizeof operator is applied to an array and to a pointer to the same array. Applying the sizeof operator to vector will return 20, the number of bytes allocated to the array. Applying the sizeof operator against pv will return 4, the pointer’s size. The pointer pv is an lvalue. An lvalue denotes the term used on the lefthand side of an assignment operator. An lvalue must be capable of being modified. An array name such as vector is not an lvalue and cannot be modified. The address assigned to an array cannot be changed . A pointer can be assigned a new value and reference a different section of memory. Consider the following:

pv = pv + 1;
vector = vector + 1; // Syntax error

We cannot modify vector, only its contents. However, the expression vector+1 is fine, as demonstrated below:

pv = vector + 1;
6
submitted 4 months ago by modev@programming.dev to c/hare@programming.dev

There is a port hare-lang, but as Drew DeVault answered my question "Just want to know - is this port official hare distribution and is it updated?":

"We do not maintain downstream packages. It's official if that's an official source for your distro."

So I found a good manual on how to do this from repos:

There are 4 total things you need to install to get Hare working on FreeBSD, 2 pre-requisites and 2 Hare packages. It's possible that you already have the pre-requisites setup, in which case you can skip the step, but they are uncommon enough that I'm including them here.

I did the installation in a fresh jail for isolation, but of course you can install where ever you like, the steps are the same.

Initial setup

First you'll need git:

pkg install git

Since we're installing from source, we need somewhere to put the source, so I created /usr/local/src

mkdir -p /usr/local/src
cd /usr/local/src

Now we can start building packages.

Pre-requisites

QBE

QBE is a compiler backend used by Hare.

First clone the repository:

git clone git://c9x.me/qbe.git
cd qbe

Then build and install:

make
make install
cd ..

scdoc

scdoc is a man page generator, first clone:

git clone https://git.sr.ht/~sircmpwn/scdoc
cd scdoc

scdoc uses syntax in its Makefile not supported by BSD make so you'll need gmake:

pkg install gmake

Then use gmake to build and install:

gmake
gmake install
cd ..

Hare

Now with the prereqs you can install Hare itself, first the bootstrap compiler:

git clone https://git.sr.ht/~sircmpwn/harec
cd harec

Copy the FreeBSD config from the configs folder:

cp configs/freebsd.mk config.mk

Then build and install:

make
make install
cd ..

Last up is the main package:

git clone https://git.sr.ht/~sircmpwn/hare
cd hare

Like last time, copy over the FreeBSD build config:

cp configs/freebsd.mk config.mk

Before building, Hare depends on as, an assembler, which you can get from binutils:

pkg install binutils

And with that you should be able to build and install:

make
make install
cd ..

Hello world

First, let's do a simple Hello world.

echo 'use fmt;

export fn main() void = {
	fmt::println("Hello world!")!;
};' > main.ha

Which you can now run with the hare run command:

hare run main.ha

It will take a second the first time, but you should then see the print out. To build to an executable use the build command instead:

hare build -o helloworld main.ha
./helloworld

And that's it, I hope this is helpful for FreeBSD users out there.

[-] modev@programming.dev 2 points 4 months ago

Thank you for benchmark. Python is a player, lol.

Rust is very overhyped and I do not accept its syntax, boring. I like C and Hare. I am not a system dev, it's just a hobby, so my opinion can't be proved by solid experience. But I came to C after learning and trying using Rust in a hobby game dev. Hare I like to have in my backpack as an alternative, fresh and developing tool. It is not overhyped and his team are not trying to reach popularity. Just making not bad language. IMHO.

[-] modev@programming.dev 3 points 4 months ago

Some devs just learn new languages to expand their view or to avoid burnout. Yes, I agree that memory safety is not a problem and all these C-killers suck. Hare is not positioned as a C killer, it can be used together with C.

And look at today's situation in the industry. Try to say in the Rust community "Rewrite it in C" or suggest some newcomers to write in pure C some app. All these commercial developments smell bulked overhyped technologies that have only one goal - make money for companies and companies support these tech. All job offers do not expect you to be an expert in computer internals or C, or even JavaScript. You just need to know the frameworks.

All of these bring pure software quality. C will never die, and those who write on it will do. But newcomers need something different and better it will be as efficient as C.

It is just one point of view...

5
submitted 4 months ago* (last edited 4 months ago) by modev@programming.dev to c/hare@programming.dev

What do you think about Hare? I think it takes best from different languages, intentionally or not...

It is simple like C, but safer, and at the same time allows you ~~to shoot yourself in the foot~~ to take control and make mistakes if you want.

Example from this blog post two years ago:

fn io::write(s: *stream, buf: const []u8) (size | io::error);

// ...

sum += match (io::write(s, buf)) {
case let err: io::error =>
	match (err) {
	case unsupported =>
		abort("Expected write to be supported");
	case =>
		return err;
	};
case let n: size =>
	process(buf[..n]);
	yield n;
};

Expression-based syntax and match statements remind me of Rust, but it implemented simpler without options...

Maybe you already used Hare in your project. Interesting to read your feedback...

Do you like it? Why?
Dislike? Why?

[-] modev@programming.dev 2 points 4 months ago

You can ask about it on the official IRC channel. The creator of the Hare is based there.

2
submitted 4 months ago* (last edited 4 months ago) by modev@programming.dev to c/hare@programming.dev

Interview with the creator of the Hare programming language.

[-] modev@programming.dev 2 points 4 months ago

Thank you for your support. Yes, and new tech is not always good.

1
submitted 4 months ago by modev@programming.dev to c/zig@programming.dev

What does it mean?

[-] modev@programming.dev 3 points 5 months ago

Thank you for your answer. I am not a professional C developer. I am learning it just for myself and have no production products written in C. And I can imagine how difficult is to support something really huge and commercial. Now C is more for hobby developing and tooling. But I know guys who are making desktop apps in C just for performance.

[-] modev@programming.dev 15 points 5 months ago* (last edited 5 months ago)

I advise you to learn something different and hard for you. Only this case will help you to grow and realize a lot of new.

  • Rust for hard
  • Nim for something different
  • C for understanding how things work

All these languages are efficient and forget about hype and popularity. Language does not matter if you have what to write with it.

[-] modev@programming.dev 4 points 5 months ago

But the time machine has been written in C so you could not return back and had to write a C compiler from scratch. Here the story about returning to the roots begins...

view more: next ›

modev

joined 5 months ago
MODERATOR OF