Masthash

#C

UE in Italia
16 hours ago

.@dubravkasuica Le dinamiche demografiche devono avere un ruolo nella definizione delle politiche per la transizione verde e digitale!
@EU_ScienceHub

I ricercatori hanno unito i due mondi: #Demography e #ClimateChange!
➡️http://europa.eu/!fbtdHm
#JRCanticipate
RT @dubravkasuica: Population dynamics need to play a role as we design policies for the green and digital transition!

@EU_ScienceHub
researchers linked the dots between the two worlds: #Demography & #C

🐦🔗: https://n.respublicae.eu/europainitalia/status/1665667893583831041

Susi Arnott
18 hours ago

“Worth £1billion, the true value of Williams land lies in its ecological importance- reducing sheep grazing would be an undemanding first step”
#GreenTheDuchy #Dartmoor #deedsnotwords #C&Eemergency
https://twitter.com/wildcardrewild/status/1665623198040195072?t=T-xQEIeT0x2XLGxfmbIFCQ&s=19

Jack William Bell
22 hours ago

> CrossDB. High Performance Embedded Database Development Framework. https://crossdb.org/

RDBMS style database (tables, rows, indexes), but no SQL; everything is done directly with a library and C Macros. You define tables using C Structs.

I suspect this is blazing fast. The use case would be replacing SQLite any time SQL just isn't fast enough. But it would also mean writing your own join code, so there's the tradeoff.

Edit: May not be Open Source.

#C #CPP #programming

Arav K.
1 day ago

It turns out that it's possible to have associated types and values in #c using a few extensions supported by #gcc and #clang . The basic foundation for this is zero-length arrays: you can insert a unit-alignment zero-length array field into any `struct` or `union`, and although it won't affect the layout or storage of the type, the array element type (which can be a `struct`) can be extracted with `typeof()`.

Jari Komppa 🇫🇮
1 day ago

Wrote an implementation of the "three shears" non-destructive sprite rotation which may be of some use to retro platform developers.
Source: https://github.com/jarikomppa/spriterotator
A little bit more info: https://cohost.org/sol-hsa/post/1617419-sprite-rotator

#animation #gif #retro #pixels #c++ #gamedev #rotation #shear

2 days ago

Here's a blog post benchmarking compilers by “Hello, World!” and Ruby didn't fare well.

https://drewdevault.com/2020/01/04/Slow.html

#MastoDev #FediDev #Programming #Assembly #Zig #C #Rust #Go #Java #Python #Ruby #Permacomputing

I see what people were talking about when they say #Rust is hard to get going for a new project. I've got the idea set up, but I have to get it all implemented and it's a bit of a pain.

Definitely like this more than #C or #Python though, the compiler is a great help.

#rustlang

2 days ago

The decision to use Ruby for Mastodon was a poor choice, to put it mildly.

The diagram below shows relative energy consumption, with values normalized to the most efficient one. So C, as the most energy efficient, has the value 1.

#MastoDev #FediDev #Programming #C #Rust #CPP #Java #Lisp #Haskell #Go #JavaScript #Python #Ruby #Permacomputing

The diagram shows relative energy consumption, with values normalized to the most efficient one. So C, as the most energy efficient, has the value 1.
IT News
2 days ago

C++17’s Useful Features for Embedded Systems - Although the world of embedded software development languages seem to span somewhe... - https://hackaday.com/2023/06/04/c17s-useful-features-for-embedded-systems/ #softwaredevelopment #microcontrollers #embeddedsoftware #c17 #c

Jobs for Developers
2 days ago

Quiet Saturday Darknet/YOLO time...

#c #cpp

Jobs for Developers
2 days ago

Vertical Knowledge is hiring Senior Software Engineer

🔧 #c #javascript #python #react #serverless #aws #cicd #css #elasticsearch #gcp #nosql #sql #terraform #seniorengineer
🌎 Remote; Chagrin Falls, United States
⏰ Full-time
💰 $100k - $230k (Estimate)
🏢 Vertical Knowledge

Job details https://jobsfordevelopers.com/jobs/senior-software-engineer-at-vk-ai-mar-28-2023-efb093?utm_source=mastodon.world&ref=mastodon.world
#jobalert #jobsearch #hiring

Writing Wolf
3 days ago

Developed a very different style of coding in C (and C++) for myself.

#C #programming

Part of C code in a very different style from the usual.
Jobs for Developers
3 days ago
R. L. Dane
3 days ago

@maikelthedev

It's not much, but have you started with the FreeBSD handbook? It's quite good.
https://docs.freebsd.org/en/books/handbook/

It's installable as a PDF on #FreeBSD.

When I was running #FreeBSD on my #ThinkPad, I had this in my .bash_aliases file:

handbook_file=/usr/local/share/doc/freebsd/en/books/handbook/handbook_en.pdf
[[ -f $handbook_file ]] && alias handbook='xdg-open $handbook_file'

#C:
https://craftinginterpreters.com
https://learncodethehardway.org/c/
https://www.codecademy.com/learn/learn-c
https://beej.us/guide/bgc/

Eric G.
3 days ago

I love this stuff. Having started myself in the 6502 world, programming in tight places has always been something that I admired, even if I was never as clever as others.

#Forth #C #Compilers #512Bytes #Software

https://xorvoid.com/sectorc.html

AskUbuntu
3 days ago

I want to create a Morse Translator(in C++ language) that can be both used in Windows and Linux(I am using Ubuntu to compile) #compiling #gcc #c++

https://askubuntu.com/q/1470405/612

Skye
4 days ago

May as well do a #introduction post
Hi! I'm Skye, who used to be
@exokai@meow.social

Some quick facts about me:
- I'm transfem
- I have autism
- My sona, also called Skye, is a transfem shark
- I live in the UK (aka TERF Island :/ )

My hobbies:
- I do a lot of programming in languages such as
#c++ , #rustlang , #kotlin and #pythonlang
- I know a decent amount about HPC programming (I've used
#cuda , #opencl , #hiplang and #vulkan compute)
- I own an FPGA that I want to do something useful with
- I really love old computers, esp ones to do with the history of HPC, such as SGI machines - sadly I do not own any of these computers as of writing this :(
- I've participated in the homebrew scenes for the Original Xbox, and the PS3
- On the note of consoles, I own: an Xbox One S, a PS3, an Original Xbox, a Wii, and a GameCube
- Other than programming aligned interests, I really like:
- Trains (expect me to post a lot of train photos/videos when I go on them lol)
- Cosplay - sadly I've never actually owned a cosplay or made one, however, I've been to quite a few comiccons around the UK, and one day, when I have the money, I'd love to make/buy a cosplay (I might make a cosplan post at somepoint?)
- I'm also into Mountain Biking, and when I do it I may upload videos of cool shit I do lol

Shows I've watched and loved (and where my cosplans mostly come from lol - also, these are in no particular order):
- The Dragon Prince
- She-Ra (2018)
- Yakitori
- The Owl House
- Avatar: The Last Airbender
- The Legend of Korra
- Arcane
- Brand New Animal
- Voltron

Links:
- My GitHub profile:
https://github.com/ExoSkye
- My Transistor Cafe site:
https://transistorcafe.net/~exoskye/
- Discord - ask me personally for my tag if you want it
- My Email: exoskye@duck.com

Also, if anyone wants to donate some money to me (i have none rn lol), then you can do so via my PayPal which you can get by communicating with me directly in a DM

Anyway, thanks for checking out my profile!

I have no idea why it took me this long to notice. This application uses:

printf("\nblah blah");

Instead of:

printf("blah blah\n");

Part of the problem is when it prints a warning or an error and then waits for the user to press a key to continue. Without the trailing \n, the error message never gets flushed!

I cannot fix this without touching every single printf() in this old-style C application.

This may encourage me to switch everything to C++ sooner.

#cpp #c

playing around with lowlevel graphics with #C and #SDL...I am well out of my depth here...

uftrace is a function graph tracer for C/C++/Rust/Python that allows users to trace the function call path of a program. The tool is open source and available under the GPL-2.0 license. https://github.com/namhyung/uftrace #C++ #Rust #opensource #softcorpremium

5 days ago

Ein Arbeitskollege aus Oslo hat mir gerade via Teams eine Frage beantwortet, die ich unter einem Nickname in #c++-basic auf libera.chat gestellt habe.

Ich habe mit diesem Kollegen *sehr wenig* zu tun und trotzdem konnte er die Verbindung herstellen.

Jeder ist stalkbar, jeder ist doxxbar.

AskUbuntu
5 days ago

c++ CURL POST TLS handshakes missing #c++ #curl #https

https://askubuntu.com/q/1470256/612

IT News
5 days ago

How to use advanced Dapper features in ASP.NET Core - The Dapper ORM (object-relational mapper) has gained widespread popularity for working... - https://www.infoworld.com/article/3698228/how-to-use-advanced-dapper-features-in-asp-net-core.html#tk.rss_all #developmentlibrariesandframeworks #softwaredevelopment #webdevelopment #microsoft.net #c#

Eingfoan :donor:
5 days ago

Using #sap sometimes feels like my days when I learned #c #programming

Input
Non understandable error
Input different
Error
Correct again
Compile complete
Run
Non understandable error

Lobsters
6 days ago

Testing the Packet Protocol: Bare Metal Programming Series https://youtu.be/rG1Faau2QuM | https://lobste.rs/s/5r7gca #c #hardware #video

Paul Barker
6 days ago

New Blog Post: Some links from May 2023

https://pbarker.dev/posts/2023-05-31/some-links-may-2023/

I'm still in the process of trying out different styles of blogging to see what works for me. Today we'll be roleplaying as a link blog, but with one aggregate post covering the month of May instead of one post per link. Let me know what you think!

Topics covered: #C #LinuxKernel #Rust #Python and a grab-bag of others.

#Blog #Linkblog

Marco Ivaldi
1 week ago

#SectorC: A #C #Compiler in 512 bytes

“Big Insight #2 is that atoi() behaves as a (bad) hash function on ordinary text. It consumes characters and updates a 16-bit integer. Hashes are perhaps the holy-grail of computer-science. With a good hash, we can just side-step all the hard problems by trading them for an even harder problem (hash collisions), and then we just ignore that harder problem. Brilliant. (sticks fingers in ears) 🤪”

https://xorvoid.com/sectorc.html

Heath Stewart
1 week ago

@preslavrachev @danielquinn Depends on the experience, I think. I learned #C back in the mid- to late-80s and many languages since. #golang feels more like C in terms of error handling with a slight bit of C++ like thiscall calling convention for associative funcs. And as much as I like #rustlang for systems programming or WASM, it's like writing STL but with better errors when you inevitably anger the compiler. Go is a no-frills, simple language not getting in my way - great for many tasks.

@dog_of_dogs

You mentioned you are interested in: rust, javascript, and c.

...

There are hash-tags for each of those —

#C #JavaScript #Rust

You can follow each of those hash-tags.

...

Also, if you look at who posts under each of those hash-tags (and look at their profiles), you may find other people to follow.

Kevin T
1 week ago

Honestly, I think I might like C for most use-cases than C++, if not for the weird name-clash potential of the former. #programming #C

Conor Hughes
1 week ago

running a personal project's perf test on NetBSD, clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) appears to be able to go backwards. weird, but also looking into it both Linux and FreeBSD have had the same problem in the past? #c #NetBSD #posix

Mark Gardner ‍:sdf:
2 weeks ago

@EndlessMason #FFI works with either static or dynamic linking. #Perl and many other language toolchains default to the latter, but you can still built a big statically linked binary if you’re so inclined.

In contrast, #GoLang (for example) defaults to static linking that includes the runtime along with your code in one executable. It does have a `cgo` feature that lets you call #C code by building and compiling C glue code with your C compiler and then linking it with your #Go.

SectorC: 512 byte C compiler: A compiler stuffed in an unimaginably small amount of x86 code. Not exactly C but a useful subset.
https://xorvoid.com/sectorc.html
#via:lobsters #programming #compilers #demoscene #hacks #scene #x86 #+ #c

Mark Gardner ‍:sdf:
2 weeks ago

@EndlessMason Almost every “safe” language has some kind of foreign function interface where guarantees break down. #Java has JNI, Microsoft .NET has P/Invoke, and #Rust just calls theirs #FFI.

Perl’s XS is a glue language mostly made up of #C macros that lets you wire up Perl’s guts to C code. There are also alternatives like #SWIG and FFI::Platypus, the latter of which uses a separate portable library (written in C, natch) that can talk to lots of calling conventions, not just C.

Raphaël
2 weeks ago

Vous connaissez le gars qui a branché sa souri pour la charger à un câble qui n'était pas branché à l'autre bout ?😅
#C'estSurÇaMarcheMoinsBien

Lobsters
2 weeks ago

Implementing a custom bootloader packet protocol: Bare Metal Programming Series https://www.youtube.com/watch?v=RrUyS-gixWk | https://lobste.rs/s/fqd6yj #c #hardware #video

2 weeks ago

How to pass complex data types, like records between Ada and C (and ultimately Ada and C#) via a DLL? https://stackoverflow.com/questions/76305462/how-to-pass-complex-data-types-like-records-between-ada-and-c-and-ultimately-a #ada #programming #dll #ada #c

Lewis Westbury 💛💙🌱
2 weeks ago

About 300 installs of my Flipper resistance calculator app, now. I'm really happy about that 😊 https://flipc.org/instantiator/flipper-zero-experimental-apps?branch=main&root=resistors
#FlipperZero #Resistance #Electronics #App #Embedded #C #clang

A screenshot showing the entry on flipc.org for the Resistance Calculator app (an app for Flipper Zero).
jbz :catjam:
2 weeks ago

「 Now, before you go out and write your next project in Lisp, you should keep something in mind. Lisp is not the fastest or smallest language out there, it was not designed to be so. There are some pretty good implementations of Lisp out in the wild, but don’t expect them to outperform C, Go, Lua, or even Python most of the time 」
via brycevandegrift.xyz

#Lisp #Python #C
https://brycevandegrift.xyz/blog/the-importance-of-lisp/

jbz :catjam:
2 weeks ago

「 Not differentiating between C and C++ also has the side effect of ostracizing new users. Many beginner programmers are lead by the term “C/C++” to think that they’re basically the same language. In fact there are many tutorials out there that are advertised as “C/C++ tutorials”, continuing the confusion. This can also scare away C beginners by making them think that understanding the complexities of C++ are required to understand C 」
via brycevandegrift.xyz

#C #Cpp
https://brycevandegrift.xyz/blog/stop-saying-c-and-c++/

Lobsters
3 weeks ago
Lobsters
3 weeks ago

Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources http://www.parrot.org/sites/www.parrot.org/files/vmem.pdf | https://lobste.rs/s/5dco74 #c #historical #illumos #pdf #unix

Lobsters
3 weeks ago

Designing A Packet Protocol: Bare Metal Programming Series https://www.youtube.com/watch?v=VzOPdQukW1Q | https://lobste.rs/s/zvuirq #c #hardware #video

heapwolf
3 weeks ago

#Swift is a nice language. Having interop between Swift and #C++ would be neat, but with Socket Runtime we would lose out on a lot of code reuse, Windows and Linux are mostly C/C++ code bases, and our Android is mostly C++ via the #JNI, as a result there’s actually very very little #ObjC++ in the project. I’m pretty much +0 on the idea of interop.

🧵 Part 1

I downloaded #ASCIIBrot, a #Mandelbrot image generation tool for the #Linux text consolei written in #C. It allows navigation, zooming in and out, computing the images in real time. I created images and videos. Please note that the image coordinates are unkown because asciibrot does not show them.

Now enjoy the thread with a few images and videos of the #Mandelbrot set.

#Fractal #Apfelmännchen #Math #ASCII #ASCIIArt

https://en.wikipedia.org/wiki/Mandelbrot_set
https://github.com/nullJonas/asciibrot

Screenshot of the complete Mandelbrot set displayed with ACSII characters.
Zooming into the complete Mandelbrot set displayed with ACSII characters.
Dunkelstern
1 month ago

#introduction

Hi, I am known as dunkelstern almost everywhere, in real life just call me “jo”.

I am a backend-developer using python and
#javascript by day, but i am living on github by night too and working on one of those unfinished projects there (#rust, #c, #python and #cad)

If I am not tinkering with my
#smarthome you will find me in the guts of some #3dprinter or fiddling with some #electronics . Currently you'll find me in the guts of a Deckel FP4 #CNC mill.

On the weekend you’re likely to find me in our
#makerspace habitat augsburg

Say hello some time :)

Dunkelstern
1 month ago

#introduction

Hi, ich bin fast überall dunkelstern, im echten leben sagen die leute meistens Jo.

Ich arbeite als backend-entwickler mit python und
#javascript, bin aber auch privat auf github zuhause und kippe dort meine drölf millionen unfertige projekte ab (#rust, #c, #python und #cad)

Wenn ich nicht an meinem
#smarthome bastel dann wahrscheinlich an irgend nem #3d-drucker oder sonstigem #elektronik gebastel. Seit neuestem könnt ihr mich auch in den Eingeweiden einer Deckel FP4 #CNC Fräse finden.

Am wochenende findet ihr mich im habitat in augsburg, meinem
#makerspace

Sagt mal hallo :)

And my next #C question 🙂

I use #popt a lot, it is great.

I always find some memory issue left over when running #valgrind, caused by popt. It is always small and so not something I worried much about.

I noticed it seems to be that a string argument to my command from popt is in fact malloc'd. I.e. I can free() it without error, and that fixes the valgrind complaint.

But the man page on popt does not say which things it malloc's.

Does popt always do it?

On holiday with the rents and my laptop packed up, so my current solution for coding is borrowing my sister's screen tablet (since it fits nicely in a backpack) and using a Pi 3 as my main coding device.

Honestly, not great, #RaspberryPi 3 is just a little too slow to run a browser well so even just looking up basic things is easier on my phone.

But the actual coding part is fine. Doing stuff for #C at the moment because I restarted the #CS50 . Wish me luck.

😱 Brian Morearty
2 months ago

Available for hire: entry-level backend software engineer looking for full-time position or internship. He prefers Bay Area on-site.

Proficient in #JavaScript / #Node.js, #Java, #SQL. Also used #C / #C++, #Redis, #TypeScript, #LLaMA, & more.

https://linkedin.com/in/nmorearty/

This engineer is my adult son, Nick Morearty. He started as a Computer Engineering major at UC Santa Cruz but ended up deciding to take a different path. He has taken NuCamp’s Full-Stack Web + Mobile Development bootcamp, and I’ve been teaching him all about software engineering for the last ten years--since he wan ten years old. In 2020 he got a perfect 5 on the AP Computer Science test, self-taught from a book and tutored by me.

Please share for reach.

zbecker
2 months ago

With everyone investing in #ai, I am going to give my opinion on the subject and my predictions on the future.

Disclaimer: I am a CS student, not an industry professional yet.

I think it is very likely that #aiDrivenDevelopment will become a thing.

However, the thing that is currently holding it back, is the ai will sometimes "hallucinate" and do things wrong. In addition, ai code tends to be less secure, not unlike just copying code from #stackOverflow without checking it.

However, I imagine those problems will be lessened overtime, as it wasn't all that long ago that ai generated hilarious and garbled stuff from prompts.

I think prompt engineering might end up becoming a core part of cs courses.

I think the most similar example I can think of this development is the development of high level #programming languages, such as #python.

Everyone knows python and #java are much slower than #c, #c++, or #rust. However, it is often quicker (and thus cheaper) to write in python when speed does not matter.

otheorange_tag
2 months ago

Want(not need) help/w optimizing rando langs I've written working calculator gui cloud app servers,only rely on stdin stdout in #ada #awk #bash #basic #C #cplus #COBOL #CLisp #Forth #FORTRAN #Go #java #Lisp (mine) #Lua #Pascal #Perl #Python #R #Rust #Ruby #SED These all work and talk to the thin client @ other end of a socket just fine, but lots are my first ever app in language. LMK if you have smaller https://bitbucket.org/timcdoc/antibrowser/src/master/ $lang calc under that. also looking for destupify stdio|powershell

Juan
2 months ago

Hi, just moved to this instance so is time for a new #introduction!

I love open source and also do (retro) gamedev (ZX Spectrum, Amstrad CPC, MSX and Commodore 64; sometimes PC), and other types of "dev" in #Scala, #Python, #C, #Z80, and #Haskell.

My games are always free to download and play, go and check:

https://www.usebox.net/jjm/

(some of the retro ones have physical edition too)

Moved from mastodon.sdf.org.

Collector's edition of Kitsune's Curse (Amstrad CPC).
Collector's edition of Night Knight (MSX).
Collector's edition of Brick Rick (Amstrad CPC).
bµg
2 months ago

Hey #compilers folks, I'm looking for a sample code in #C that depicts a for-loop compiler optimization based on the fact that a signed overflow is UB.

for(int i=0;i<=N;i++) cannot overflow (UB) but can with unsigned, which is why int is preferred. What benefit does the monotonic property assumption give to the compiler? Any example to demonstrate the optimization?

Now, using <= is actually rare in my experience, so can a similar optim be triggered with let's say for(int i=start;i<end;i++)?

Barry Schwartz 🫖
2 months ago

I added #ATS to the #RosettaCode task for the #Mandelbrot set:

Mandelbrot set - Rosetta Code https://rosettacode.org/wiki/Mandelbrot_set#ATS

The #C entries include some #OpenGL stuff, though, which I am tempted to duplicate in ATS.

#ATSlang

Zack Weinberg
2 months ago

A Puzzle for #C language lawyers:

Can you think of a way to modify the part of this program between // MODIFY THIS PART and // END so that the whole thing fails to compile, but, and this is key, it compiles again if you replace extern int getgroups(); with extern int getgroups(int, gid_t *); ?

#include <sys/types.h>
extern int getgroups();

// MODIFY THIS PART
typedef int (*posix_getgroups_ptr)(int, gid_t *);
volatile posix_getgroups_ptr getgroups_p = getgroups;
// END

int main(void)
{
return getgroups_p != 0;
}

Barry Schwartz 🫖
2 months ago

This #compiler for the #RosettaCode Virtual Machine assembly language can now target any of #ATS, #C, #Mercury, or #Scheme --

https://sourceforge.net/p/chemoelectric/rosettacode-contributions/ci/default/tree/vmc.dats

The Scheme code runs very fast in #ChezScheme, so-so in all else I have tried. I wonder how they do it. Maybe a lot of C code (instead of Scheme) in the runtime is part of it?

The generated Mercury is not so fast, but such is life with Mercury. It’s fastish, considering.

#ATSlang #ContinuationPassingStyle #FunctionalProgramming

Barry Schwartz 🫖
2 months ago

I decided to keep going and have added "vmc", the virtual machine compiler: https://sourceforge.net/p/chemoelectric/rosettacode-contributions/ci/default/tree/vmc.dats

No guarantee it works at any given time--though, if I am good, I can work with Mercurial branches. Right now it can compile to #ATS and to #C

#Compiler #FunctionalProgramming #ATSlang

The ATS it makes does tail calls. The C uses goto--many more goto than are needed, but optimizers might clean that out. The generated code is in continuation-passing style.

Matthew Slowe
2 months ago

@Edent it may not be closed any more but #SunMicrosystem's #C #Compiler was a closed-source thing #cc (now #Oracle Developer Studio so chances of being #opensource are slim! https://en.wikipedia.org/wiki/Oracle_Developer_Studio)

Haha this is great. Ken Thompson refuses to take a test on how well he knows C, so Google won’t let him commit code. #C #Software #Developers #UNIX

https://www.theregister.com/2010/04/21/ken_thompson_take_our_test/

Barry Schwartz 🫖
3 months ago

(This is true because OCaml is an UNSTANDARDIZED language in which they change things.

I used to work on the code of ANT, which was written in OCaml, but I think it would require substantial rework to function with the current compiler.

Standard ML OTOH is a language with a thorough standard, like #Fortran or #Ada. You can write in it today, have your program work practically forever. It’s a deliberate plan. #C nowadays is like that, too.)

Sumana Harihareswara
3 months ago

https://engineering.nyu.edu/events/2023/03/21/foundations-first-improving-cs-viability-introductory-programming-courses

March 21: "Foundations First: Improving C’s Viability in Introductory Programming Courses with the Debugging C Compiler" - a live talk, evidently viewable over Zoom

If you ever teach people C or learn C, this might interest you

#programming #C #teaching #EngineeringEducation #education

PSA: Did you know that function argument evaluation order in C is undefined, and gcc / clang are actually doing the opposite of each other?

I did, but that knowledge didn't make today's debugging session much shorter and less puzzling.

The starting point was that the same code worked fine on Linux but doesn't work on macOS. Nothing system-specific anywhere near the error.

As it turns out, somewhere deep down there was some code relying on a specific argument evaluation order. Something in the shape of

copy(reader_read_data(r, reader_get_remaining(r)), reader_get_remaining(r));

With gcc this copied the remaining amount of data, with clang this silently copied nothing. gcc is evaluating arguments right-to-left, clang left-to-right. So clang was first advancing the cursor to the end, and then the remaining amount of data was actually 0.

Should you write such code? No. Does it make sense for the code to behave differently with different, well-behaving compilers? Also no.

The code in question did not cause any compiler warnings, and no static code analyser I tried (including coverity) detected it either.

Fortunately another thing Rust got right: argument evaluation is explicitly defined as left-to-right.

And this is just one of the parts of C with undefined, unspecified or implementation-defined behaviour. Far too many footguns to keep in mind to realistically avoid having one or another showing up somewhere sooner or later.

#C #Programming #Bug #FootGun #RustLang

Dave Mackey
3 months ago

"Ain't it fun
Living in the real world"

Where the #documentation for the #JS browser project was written for the #C/C++ project.

"Ain't it good?

...

So what are you gonna do
When the world don't orbit around you?"

😂 I actually kind of enjoy the challenge, but it does make things much more time consuming.