Похожие чаты

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 ответов

15 просмотров

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

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

Hsn- Автор вопроса
swarnim
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) ..

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

Hsn- Автор вопроса
Ihor
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? ..

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

Hsn- Автор вопроса
Hsn
Thanks for sharing, i dont understand the last pro...

Instead of accessing tail and head i ment in main

Hsn
Thanks for sharing, i dont understand the last pro...

They are talking about lack of constructors and destructors in C.

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

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
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...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
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...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта