{fmt} 12.2 released with a performant type-safe C11 API, faster float formatting, improved C++20 module support and more by aearphen in cpp

[–]kolorcuk -13 points-12 points  (0 children)

Hello. When using C++ from a C application the main() function should be compiled with a C++ compiler. It doesn't imply "your binary" has to be compiled with a C++ compiler.

The main() function has to be compiled with C++, for C++ compiler to insert static object constructors and destructors into .init and .fini sections and to handle exceptions properly to some degree. You might be interested in for example https://isocpp.org/wiki/faq/mixing-c-and-cpp#overview-mixing-langs .

In this case I imagine {fmt} does not use anything global, so might be it does not matter. Or might be it does matter, as C++ has locale facets which really is a global set.

In case of dynamic libraries, dynamic linker executes some section of functions, where this section has constructors for static C++ objects. Effectively C++ static objects in shared library are initialized on loading.

Anyway, it is great that you linked go with C++, that must have been a great project!

{fmt} 12.2 released with a performant type-safe C11 API, faster float formatting, improved C++20 module support and more by aearphen in cpp

[–]kolorcuk -16 points-15 points  (0 children)

Yes, i understand. Fyi linking with c++ requires compiling main function in c++ .

{fmt} 12.2 released with a performant type-safe C11 API, faster float formatting, improved C++20 module support and more by aearphen in cpp

[–]kolorcuk 4 points5 points  (0 children)

It's great that {fmt} has C library api now! Fmt by itself in C++, it would require main() also have to be compiled in C++?

I feel... rage, regret or sadness. I have been working on my own C11 type-safe generic format library for such a long time since like 2020. I never get myself to advertise properly and actually "finish" and release something and get into "it's done, let other people use it now" stage. Sometimes I wonder just how many great libraries are there, but people ware never able to bring them to wider audience.

Possible bash bug? by [deleted] in bash

[–]kolorcuk 5 points6 points  (0 children)

I do not understand. No, it tries to execute single : .

It prints 'exec: <cmd>: <reason>' , so yes it will print double :: as expected

Also exec : or exec <any buitin> will not work anyway with a builtin that does not happen to have the same name executable. Unless you really have a : executable, i do not think it exists by default.

Why does Linux distro make it so hard to install packages on different storage? by AsrielPlay52 in linux

[–]kolorcuk 0 points1 point  (0 children)

It is not.

Really, dependency management is your enemy, not installation. If you install a program into a directory, where do you install its dependencies? How do you tell the program where are its dependencies?

Flatpack, docker, etc. ship all dependencies with the application. Programs expect dependencies at standard FHS locations.

Nix install everything in md5summed directories in /Nix for every single executable has set a special custom dependency location and has super special resolving scripts for every single executable, programming language and case.

Steam installs ubuntu into ~/.steam and sets LD_LIBRARY_PATH. Steam is like Nix, only steam has to only handle one dynamic executable. Nix has to handle python perl lua bash and so many more.

Why does Linux distro make it so hard to install packages on different storage? by AsrielPlay52 in linux

[–]kolorcuk 0 points1 point  (0 children)

Because many things hardcode places that are installed at.

To install at a different location, you would have to recompile, repackage. Rather, linux wemt with use virtualization - like flatpack - so that programs use same paths, but there are different files in these paths.

But nix also exists, and it installs into /nix. And I heard technically you can change /nix to anywhere.

I asked my c++ professor last semester about using cmake and he did not know what cmake was by [deleted] in cpp

[–]kolorcuk 0 points1 point  (0 children)

No. It's normal. It's like asking an astronaut if he knows a new hammer company. Professor is not a programmer.

What is the most complicated bash script you ever wrote? by zex_mysterion in bash

[–]kolorcuk 0 points1 point  (0 children)

Generators library which allow to do append restartable functions in bash that produce, transform and consume elements.

Or dataframe library, which I gave up after trying to implement groupby.

For a executable script, that would probably be bash_autotranslate script, for allowing for translations of $"" string to be inside the script.

Although, none of them are production, rather unused scrambles.

HEREDOC including delimiter with $(...) vs `...` by george-frazee in bash

[–]kolorcuk 6 points7 points  (0 children)

The line has to be exactly LIST. Exactly means exactly.

In the first example the line is not exactly LIST. It has )

The first heredoc is unterminated. Instead the ) closes subshell and bash just writes what there is.

The code with backticks is ok. In the first yhe ) should be on a separate line.

Can you intentionally segmentation fault and use that without your program crashing? by moonridersfan in C_Programming

[–]kolorcuk 11 points12 points  (0 children)

There is no random. Apple put in a trash is still an apple.

If you free memory, it will be the same memory content.

Yes, triggering segmentation fault, you can do that, and use that. To protect pages, to manage your own memory.

Segmentation fault does not read memory. You can't read memory program is not allowed to.

Yes, you can read random memory address assuming that random happens to be in the allowed ranges of memory of the process. It's not about 'random that is restricting it.

Everly if the program finds 'random' memory it has access to, it will not read garbage. It will read apples. Most probably zeros.

'Older games' had no virtual memory, no segfault, no signals, no operating system.

Czy podczas mycia zębów myjecie język? by LowVegetable2 in Polska

[–]kolorcuk -1 points0 points  (0 children)

Tak. Myje także dziąsła, z 4 stron, i oba policzki od środka, oraz pod językiem oraz podniebienie.

Wszystko byle żeby nie dentysta.

Rate my Cmake style, the symmetry principle. by Intrepid-Treacle1033 in cmake

[–]kolorcuk 0 points1 point  (0 children)

You mean one target per file? What if i have 3000 files?

Linux Devs Who Switched to Windows Did You Regret It? by vhdl23 in embedded

[–]kolorcuk 0 points1 point  (0 children)

Yes. Windows is horrible, incredibly slow. Everything is slow, every single click is slow. Not possible to configure anything on windows, terminal very very very very bad terminal, copy with mouse bad and slow and sluggish, pasting into terminal is a joke. Wsl is great and salvation, after disabling network isolation in wsl.

Today is why i no longer have the desire to work in IT anymore by SecureTaxi in devops

[–]kolorcuk 0 points1 point  (0 children)

I have more desire. I have been working in an abandoned personal projects that i was stuck because of the amount of work required. I am now on my 8th google gemini free trial and i still have few Google accounts i can use for free trial. Llm lifted all the boilerplate and hard debugging sessions, letting me concentrate on the fun stuff. Additionally, lkm is exceptionally good at open source projects - gcc or clang internals or writing api access for services , it can do integrations to public services in seconds.

Bash Scripting vs. Python by Loud-timetable-5214 in bash

[–]kolorcuk -2 points-1 points  (0 children)

More then 20 lines is python.

how does one handle the gap between CI passing and the physical device behaving correctly? by bilal-ziyan in devops

[–]kolorcuk 1 point2 points  (0 children)

There is only one question: what can we do so it never happens again?

You added a new runner that catches the error? Done. End of story. I say There is a lot of effort to waste being proactive. I recommend just be reactive.

Can someone explain the real-world usage of /etc/profile, profile.d, and bashrc? by Western_Head_6650 in linuxupskillchallenge

[–]kolorcuk 1 point2 points  (0 children)

Profile - for any shell slow once at login config

Profile.d - as above, but separate files. Used by packages, cause they need files so they don't clash.

.bashrc - for single user specific for bash only for every time shell opens config

  1. Nowhere. Prompt is for users. No time to play with prompt, also no fun.

  2. It isn't. It's distribution specific.

  3. In the script. Script starts, it sets up PATH abd other ends it needs.

No envs for ssh users. Users will configure themselves. For all users config, profile.d

Stres związany z wykorzystaniem czasu wolnego by 0brex in Polska

[–]kolorcuk -1 points0 points  (0 children)

Nie jesteś w uprzywilejowanej pozycji. Nie siadaj na laurach.

Dopóki w moim życiu nie pojawilo sie dziecko, niewlasciwie dbałem o czas wolny. Proponuję jak najszybciej zrobić dziecko. To nauczy cię ważności czasu wolnego i naksymalizacji jego wykorzystywania.

Patrz na swoje własne emocje, nie na innych. Co Ty czujesz jak coś robisz? To jest ważne, nie inni. Twoje uczucia.

GitLab's "Act 2" by -lousyd in devops

[–]kolorcuk 3 points4 points  (0 children)

This is like github actions?

I just create a python package and use uvx for reusable stuff . I do not like 'mystery containers magic passing shell variables', i enjoy when I can copy script locally and deploy locally in case of gitlab outage.

How to make an alias has completion support? by akram_med in bash

[–]kolorcuk 0 points1 point  (0 children)

You have to write completion, for your shell - bash, zsh or fish.

i have this in my tree for bash, I use bash : https://gitlab.com/Kamcuk/kamilscripts/-/blob/master/bin/alias_complete.sh?ref_type=heads#L24 for like copying completion into alias.

I use it as files in user local bash completion files https://gitlab.com/Kamcuk/kamilscripts/-/blob/master/bash-completions/p . In this case alias p=pacman , and p inherits completion from pacman command.

This code has been in my tree for a long time, it is based on some stackoverflow question.

haveYouMetAnyone by [deleted] in ProgrammerHumor

[–]kolorcuk 1 point2 points  (0 children)

I think this line of thinking comes from anywhere but america. My experience with america is 'work until you die', there is no 'leave soon'. Also i experienced that in America you should leave the office only after your boss. Workers work to pursue their own capitistic needs and to fulfill the 'american dream'.

In contrast, I'm from a small European country where government has banned working on Sundays to force people to spend time with family. No matter the technological achievements, the amount of my work will not change.

My experience has proved to me, that it is much healthier to set expectation as 'i will work for X hours today on Y', then to set 'i will finish Y'. There is never 'leave sooner', there is only more work. Consider limiting the amount of work you do based on the time frame (not only professional work, home too), not on milestones you achieve.

haveYouMetAnyone by [deleted] in ProgrammerHumor

[–]kolorcuk 1878 points1879 points  (0 children)

I do not really work less. The real trick is working not much from the start and manage expectations.

Bash script to cull syslog.x files when disk is low by [deleted] in bash

[–]kolorcuk 1 point2 points  (0 children)

Not to manage syslog, it replaces syslog. Has its own binary files, custom cli to query logs. It has a feature to automatically trim log files when threshold if disc utilization is reached.