modev

joined 9 months ago
MODERATOR OF
[–] [email protected] 1 points 4 months ago

This community was created by Drew DeVault. But I think he is not interested, but you can ask him.

[–] [email protected] 2 points 4 months ago (1 children)

Fixed. I have added, then added a picture and link to the picture has replaced the site link.

19
Write Free Software Community (discourse.writefreesoftware.org)
submitted 4 months ago* (last edited 4 months ago) by [email protected] to c/[email protected]
 

"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."

[–] [email protected] 2 points 7 months ago

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

[–] [email protected] 3 points 7 months ago

Agreed. Teams are a powerful option.

[–] [email protected] 2 points 7 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.

 

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!

 

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...

 

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.

79
Rust coin (programming.dev)
 

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

[–] [email protected] 1 points 8 months ago

Why am I creating these posts? Not because I want to sabotage the infrastructure or do not recognize new technologies and programming languages. Undoubtedly, new languages must appear and they must compete, because this is a natural process, of evolution. I just want to understand the mood of the C community itself. It's lukewarm on this platform. Nobody is against new languages, and they can be used together with C or as an alternative. But here we are talking about a complete replacement. So, working with memory directly is the job of whom? The chosen ones? The units that will sit behind the compilers? What about the rest? Only fulfill commercial orders? Is this engineering? Is this programming?

I look at how programming has changed over the course of 25 years, what they teach at universities, and where they start. And I came to the conclusion that on a large scale, it was all for the benefit of giant companies or the government.

We must protect the “intimate” knowledge of the foundations and water the roots ourselves. Because they don’t realize, they don’t see that if the roots are not watered, the branches on which they sit will dry out. Therefore, who, if not us? Thanks, everyone!

If you can't give me poetry, can't you give me poetical science? © Ada Lovelace

[–] [email protected] 3 points 8 months ago

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

[–] [email protected] 1 points 8 months ago

Languages have advocates, but for Rust, it looks like advocates have a language.

[–] [email protected] 0 points 8 months ago

Companies will follow recommendations, but independent C programmers must not follow them. Time will show us. But I believe C will never die.

-4
submitted 8 months ago* (last edited 8 months ago) by [email protected] to c/[email protected]
 

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

[–] [email protected] 2 points 8 months ago (1 children)

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

And are you rustacean?

 

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;
 

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.

[–] [email protected] 2 points 8 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.

[–] [email protected] 3 points 8 months ago (2 children)

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 8 months ago* (last edited 8 months ago) by [email protected] to c/[email protected]
 

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?

 

Interview with the creator of the Hare programming language.

 

What does it mean?

view more: next ›