Похожие чаты

Hi guys, i wanted to ask experts of how to

develop best practice (oop style) program in c .. with few questions in mind ..

How do you achieve good data abstraction .. (is it just hidden local variables or somthing like containers) ..

How to split functionalities into modules .. (are modules just c files or can be many c files = 1 module)

Do you achieve oop by doing structs passed to unique name functions as c doesnt have classes like c++

Are design patterns applicable in c ?

----------

Im not looking for answers here but any one suggest me a good book that answer these ?

11 ответов

37 просмотров

You can find some examples of implementing abstract data types in C https://www.embedded.com/abstract-types-using-c/

in C most people define a single file as a object/object-like modules are groups of such files that can be classified to be part of the category. And you don't do C++ like OOP in C... that's kind of the point of C.

And here is some short explanation of mimicking classes and inheritance in Glib https://en.wikibooks.org/wiki/C_Programming/GObject

Фетровый Шахматист
And here is some short explanation of mimicking cl...

I prefer to not muddy the water with GObjects and Glib in general... There aren't a contemporary of usual modern C development.

Тороидальная-Лилия Автор вопроса
Растущее Домино
in C most people define a single file as a object/...

Right, my mistake to ask about oop in c .. i just ment (best practice) ..

Растущее Домино
I prefer to not muddy the water with GObjects and ...

Glib and Gtk+ are modern C libraries that are actively developed and pretty widely used I don't know what you mean by "not contemporary"

Тороидальная-Лилия Автор вопроса
Фетровый Шахматист
You can find some examples of implementing abstrac...

Thanks for sharing, i dont understand the last prograph (what's missing) .. if initialize buffer function is missing then just implement it in the buffer.h instead of doing it in main? ..

Фетровый Шахматист
Glib and Gtk+ are modern C libraries that are acti...

They aren't usually used in C projects. Only 1 out of tens of my C projects have them as a indirect dependency...

Растущее Домино
They aren't usually used in C projects. Only 1 out...

You usually don't try to emulate inheritance either. The question was about techniques analogues to OOP in C.

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Мелодичный Сырник
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Фетровый Лингвист
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Настойчивый Кварк
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
Льдистая Лужица
2
30500 за редактор? )
Замшевый Алхимик
47
а через ESC-код ?
Виноградная Притча
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Звенящий Циферблат
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Туманный Ларец
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Длинный Минерал
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Тягучая Ракушка
11
Карта сайта