169 похожих чатов

Now if you're going to attack rust freely, why don't

I go on c++?
According to chrome, 70% of all its bugs are from the smart developers like you that think keeping 2 variables A and B relient on each other is a good idea, because no developer down the line will forget it and mess up
https://www.chromium.org/Home/chromium-security/memory-safety/

24 ответов

47 просмотров
Holmes- Автор вопроса

Also what about some string manipulations? Or installing a package? Installing a package can't be that hard, right? Wait are you telling me that I just spent 4 hours on writing build scripts and this 2 packages just don't want to work together? Wait companies hire build developers to write the build scripts? What about my app that has huge async nature, it can't be that I have to use OS api and impl everything for every OS, there has to be some lang level runtime, no? Why do I need to write my tests in python? This is the frustration I have always met whenever I worked on c++ projects, and the things rust just does right. Giving all of this benefits to save memcpy that the program spends less then 2% of its lifetime on? This ignores how much I love the rust trait system, and hate c++ oop system, where a class is more a riddle than an API

I think issues like this are in large part because of: * Global allocator * Lack of bounds checks * RAII hiding the details that beginner developers need

Holmes
Also what about some string manipulations? Or inst...

Yep, that's my experience with C++ too, it's terrible, I'm not saying that you'd use C++ for everything, just the critical hot path where performance mather

Holmes- Автор вопроса

You do realize that this 1 memcpy problem where c++ is smartly preallocating memory at the destination isn't going to make that much of a difference for anything but your carefully crafted example that abuses it to the max?

Holmes
You do realize that this 1 memcpy problem where c+...

That's not what the optimization is I think

Holmes- Автор вопроса
Thomas
That's not what the optimization is I think

That's literally what it's: A example() { A value; ..... // func body return A; } If A impl move contrcutor c++ will allow it self to preallocate A at the calling function and avoid memcpy at the return

Holmes
You do realize that this 1 memcpy problem where c+...

preallocating stack space for copies is necessary no matter what you do

Holmes- Автор вопроса
Thomas
preallocating stack space for copies is necessary ...

In c++ the function aboves uses the memory from the destination is what I mean by preallocating

Why do you think these bugs occur so frequently in C/C++?

Thomas
Why do you think these bugs occur so frequently in...

I have read some OpenSSL source whenever exploits were found in that codebase, and the only conclusion I can draw from that is that the exploits occur because the codebase is so horrible

Holmes- Автор вопроса
Thomas
Why do you think these bugs occur so frequently in...

Being 70% of all reported bugs sounds frequently, no? And also my personal experience. I don't think I've ever compiled a big and complex program in c++ and it just worked clean of bugs. In rust it's not rare

Holmes- Автор вопроса
Thomas
Why do you think these bugs occur so frequently in...

Did I miss understood this question? I think that trusting people to manage their own memory is just a bad idea. It doesn't work in big projects and fails the test of time. It's also an endless loop, many times fixing a memory problem opens a new one. The rust borrow checker isn't my favorite feature of rust, but it does this amazing job of promising you that if this is "safe rust" (no unsafe keywords), and it compiles, it's clean of them

Holmes
Did I miss understood this question? I think that...

Why do you think it works in some domains with the same languages? gamedev, aeronautics, embedded, firmware, ...

Holmes
Did I miss understood this question? I think that...

I think it depends a lot on the strategy people end up picking, and I think traversing structures to individually free many small allocations is a terrible way to do it

Holmes- Автор вопроса
Thomas
Why do you think it works in some domains with the...

In what aspect? For firmware I'd always choose c/c++. This environment is naturally unsafe, you won't get a better expeirence with rust, in fact quite the opposite, would be forced to put unsafe all over the code and fight the compiler for the things neither of you can guarntee but just have to believe is the case. It does seem like some enthusiastics are working hard to build a better rust environment for this, claiming rust async system fit very naturally embedded systems and can prevent the need for a RT OS https://embassy.dev/. I haven't tried myself but I'm hopeful. Gamedevs don't give a shit. It'll take bevy years to reach the scale of something like unreal, but gamedevs wouldn't bother anywhy. They wouldn't learn to design their games in a safer way, and they don't want to fight the compiler. Gamedevs will even abuse UB if it works. Who loses from a vuln in games either way? It's not like the game runs on their machine, and if it crashes the player will just start the game again

Holmes- Автор вопроса
Thomas
I think it depends a lot on the strategy people en...

This is also a great point. Gamedevs are excellent at doing this, in fact they're so good at pre-allocating huge mem areas they'll allocate much more than needed if it means simpler code, and it actually works to prevent bugs that would be critical (as oppose to vuln that need to be exploited)

Holmes
In what aspect? For firmware I'd always choose c/c...

I have no hope for Rust async + embedded lol, but what I mean is; why do you think memory safety bugs are much fewer in C/C++ in embedded and games?

Holmes
This is also a great point. Gamedevs are excellent...

Also works with the OS since memory is used in a linear fashion most of the time, so it's easy for the OS to conserve physical memory if the game doesn't use everything

Holmes- Автор вопроса
Thomas
I have no hope for Rust async + embedded lol, but ...

They aren't, they just not as issue as compared to, idk, a server that serves millions of users that can freely exploit its vulnerabilities

Holmes- Автор вопроса
Thomas
Also works with the OS since memory is used in a l...

Ye, it's a great approach that solves many problems and gamedevs abuse it to the limit

Thomas
They really are fewer

Maybe for gamedev the answer is very simple

Похожие вопросы

Обсуждают сегодня

Добрый вечер. Есть вопрос, а может и предложение. Был у меня диалог в другой группе о делфи и я задался вопросом: "А нельзя ли в делфи цвет //коментария и {комментария} сде...
Kraszx
24
Всем привет! Подскажи, пожалуйста, как передать в TComboBox сразу значение и id записи. На Delphi я делал так: ComboBox1.Items.AddObject('Какое-то значение', Pointer(id запис...
Евгений
13
Мдя, прикол, боевая сборка запускается (именно под отладчиком) после F9 примерно полторы минуты (97 секунд если быть точным). Начал копать - проблема детектится сразу - зависа...
Александр (Rouse_) Багель
38
я так понимаю, я так подозреваю, что создание такого плагина для человека, кто умеет писать плагины для делфи потребует минут 5-10 времени. но это мое подозрение. хотелось бы ...
Kraszx
7
Товарищи, кто работа с iphelper? Или может я в самой логике ошибки фигачу, не пойму.... var ifTable : PMIB_IFTABLE; size, corSize: DWORD; Buffer ...
Warfarellen
4
Здравствуйте, вопрос по структурам данных. Были у вас случаи, когда пришлось писать деревья или двунаправленные списки?
/ /
50
Коллеги, добрый вечер. Создаю коллекцию от TFPGMap, ключ - перечисление, значение - целое. Нужно отсортировать коллекцию по значению. Как это можно сделать?
Kirill Filippenok
11
Скажи а ты когда этот канал создавал ты уже дельфи не любил, или это со временем пришло?
Роман Лях (rgreat)
18
Привет, такой вопросик появился кажется ли вам что Rust слишком сложный/строгий для высокоуровневого программирования и слишком "безопасный"/строгий для низкоуровневого?
Крокант
10
Всем привет! Использую кастомное модальное диалоговое окошко, все по классике - mrOK, mrCancel как ModalResult. Однако есть нюанс - в главной форме есть универсальный обработч...
Олег Гранишевский
20
Карта сайта