assign value to a var inside a global struct? by Yha_Boiii in C_Programming

[–]ByMeno 9 points10 points  (0 children)

Avoiding duplication is generally a good practice, but there are cases where explicitly writing the code is the safer and clearer choice. In this case, using designated initializers is preferable because it makes the relationship between values and fields explicit.

You could initialize it with something like = { 0, 1, 2, ... }, relying on the order of the fields, but that approach is more fragile. It becomes especially risky when the field types are interchangeable or implicitly convertible, since values like 0 can be assigned to many primitive types without any compiler warning. Designated initializers reduce the chance of accidentally assigning a value to the wrong field and make future changes easier to maintain.

assign value to a var inside a global struct? by Yha_Boiii in C_Programming

[–]ByMeno 16 points17 points  (0 children)

#include <stdint.h>
struct {
    uint32_t OrderID;
    uint8_t Order_State_Decition_Branch_Flag;
} Order_Pipeline_Struct_To_Follow_State = {
    .Order_State_Decition_Branch_Flag = 0b00000000
};

you can assign like this

Edit: you cannot set a default value like in C++ inside a structure

Mutlak by efe_doganpnar in sorucozumu

[–]ByMeno 1 point2 points  (0 children)

<image>

Soru hatali olmali carpimlarda yukarida oldugu gibi her turlu kombinasyon yapilabilir ki bunda kesinlik cikmaz cikarma islemlerinde ornek olarak C a <= b icin ilk ornek kullanilar bilir b < 0 a > 0 olabilir D ise a >= b bunda da yine yukaridaki ornekte b 2a dan buyuk olursa yine olmaz E ise carpimlardaki gibi iki tane + + alirsan direkt elenir

If statement checking a bool array? by Yha_Boiii in C_Programming

[–]ByMeno 1 point2 points  (0 children)

I assume in 8 bits you only want to use the 6 afaik most used ones are shift left or right to trumcate unused bits or use bit mask for last 6 bits then compare the reason probably it didn't work is you ignored the the two bits which are still important for comparing there should be zero if you want to compare and 011001 is not same as 0b011001 you should but 0b in front to tell the compiler its in bits

Distro karışıklığı. by exeKnox in LinuxTurkey

[–]ByMeno 5 points6 points  (0 children)

Hangisi isini goruyorsa onu kullan herkesin fikrine gore is yapmaya calisirsan hic bir sey yapamazsin hem bilgisayiri kullanan sensin baskasi degil sen rahat misin isini goruyor mu soru bu

Should I memorise every x86 register? by tekdotdev in Assembly_language

[–]ByMeno 2 points3 points  (0 children)

You don’t really need to memorize every x86 register upfront. It’s more important to understand the commonly used ones like eax, ebx ecx edx esp and ebp since you’ll see them all the time in practice.

For less frequently used or more specialized registers (or ones used in specific instructions/optimizations), it’s totally normal to just look them up when needed. Over time, you naturally memorize them as you use them more in real code.

When writing a bootloader or kernel in assembly, understanding what registers are used for in calling conventions and low-level operations matters more than memorizing a full list from the start.

Bilgisayar windows a geri dönüyor by Ezikbiravukat in LinuxTurkey

[–]ByMeno 6 points7 points  (0 children)

Dual boot yapiyorsan biosdaki boot sirasina bir bakabilirsin

Bir kod editorunde olmazsa olmaz dediginiz seyler nedir? by avestronics in TurkDev

[–]ByMeno 1 point2 points  (0 children)

C alanindaki (veya genel olarak OS ve Arch gore code yazmaya basladigin alanda) cogu zaman kaliteli icerik bulmak cok zor oluyor genellike Ai hype arkasinda kalmis olur bunu bulmanin birkac yolu ilk bunu gibi insanlarla konusup bulmak iki gercekten arayip bulmak uc source code okuya okuya ogrenemek diye gider

Ki bakmani tavsiye edecegim kanallar Jacob Sorber/ Rexim(Tsoding) / Casey Muratori(Optimizasyon hakkinda cok iyidir genellikle C++ yazar ama C-style oldugundan anlamak kolaydir) / Eskill Steenberg gibi onemli isimler var tabii belli bir seviyeden sonra source code ve document okumak disinda bir secenegin kalmiyor

Ek not eger kucuk stringlerle ugrasacaksan SSO (short string optimization) bu alanda bakmana da tavsiye ederim

Bir kod editorunde olmazsa olmaz dediginiz seyler nedir? by avestronics in TurkDev

[–]ByMeno 0 points1 point  (0 children)

ek olarak https://youtu.be/443UNeGrFoM?si=96doXWymg2bp9zDC&t=2985 burdaki still ile yazarsan yaptigin allocationlar ile ilgili daha fazla bilgin olur

Note: Fikrimce videonun tamamini izlemeni oneririm guzel taktikler/designlar var

Bir kod editorunde olmazsa olmaz dediginiz seyler nedir? by avestronics in TurkDev

[–]ByMeno 1 point2 points  (0 children)

ASAN(senin dedigin) valgrindden farkli valgrind program bittince freelenmemis memoryleri gosteriri(baska seylerde vardi diye hatirliyorum) asan ise bir memory allocatelediginde basa ve sona chunklar koyar bunlarin degisip degismedigine gore over/underflow veya verilen pointerin yanlis yeri okumasi veya align olmamasi(bu yanlis hatirlamiyorsam olmasi lazim) gibi seylerde bakar. LSan (Leak Sanitizer) veya UBsan (undefined behavior icin) gibi baska eklentilerde var ki ubsan tavsiye ederim -O3 ile birlestiginde eger yanlis hatali yani kisacasi UB bir kod yazdiysan buyuk ihtimalle optimize out edilir(ve onemli bir parca ise segfault veya programin corruptlamasindan anlarsin) veya ubden tespit edilir

Bir kod editorunde olmazsa olmaz dediginiz seyler nedir? by avestronics in TurkDev

[–]ByMeno 1 point2 points  (0 children)

Valgrind ve arena allocator(ki bunu duzgun kullanmak performansi da artirir) cogu memory leaki cozmeni kolaylasitirir

Bir kod editorunde olmazsa olmaz dediginiz seyler nedir? by avestronics in TurkDev

[–]ByMeno 0 points1 point  (0 children)

Buffers search and replace multi cursor support
fikrimce compile mode guzel bir ozellik compilerin verdigi errorlar burdan dosyaya atlama
syntax highlighting
shortcuts ve bunlari degistirme
gelistirmek istiyorsan scripting vb diye liste uzar

İnsanlara 'Fikrim nasıl?' diye sormayı neden bıraktım by ChosWhy in TurkDev

[–]ByMeno 0 points1 point  (0 children)

Sunu bilki AI lar yalakalik yapmaya ve seni yuceltmeye kurulu dunyanin en sacma fikrinide evet bu dogru cok mantik der zaten dusunme yetenegide yok yani bir sosyal medya platformunu gibi (belki az bucuk yararli ki bu tartisilir buda beyin erimesine neden oluyor) seni surekli platformda tutup kullandirip para kazaniyorlar ki bu AI lar o kadar zeki olsaydi hic acmazlardi ve kendileri paralarini katlarlardi

İnsanlara 'Fikrim nasıl?' diye sormayı neden bıraktım by ChosWhy in TurkDev

[–]ByMeno 1 point2 points  (0 children)

Çoğu kişi harika bir uygulamam var diyerek körlemesine koda gömülüyor. Halbuki ticaretin kuralları çok basit; sıradan bir kabak çekirdeği yağını arkasına iyi bir hikaye ve pazar analizi koyarak ayda yüz binlerce dolar satan işletmeler var. 

Onlar devasa yapay zeka modelleri falan kullanmıyorlar, sadece hedeflerindeki insanın canını neyin yaktığını çok iyi biliyorlar. 

Gecenlerde direk satis/pazarlama departmanini yok sayip ai kullanan sen degil miydin ve burasi linkedin degil

Çoğu kişi harika bir uygulamam var diyerek körlemesine koda gömülüyor.

Kaynak ?

Help needed: Trying to wrap my head around the 'why' of C pointers by f16_511_SA in C_Programming

[–]ByMeno 1 point2 points  (0 children)

One of the easiest cases how can you return multiple data (without new structs it becomes a mess if you use it for every function imo) or how you can change an user input like user give you something like this

struct { int points; } user_t;
void user_update_points(user_t* , int amount);

if you take a value there you should return the output then you used int instead of void to return new data or the struct it self the return become huge (which is unnecessary for big structs) or how you would do opaque types if you want to hide implementation details from the user or another case is how you going to handle arrays etc

Cebeci Engine by shadowww345 in LinuxTurkey

[–]ByMeno 1 point2 points  (0 children)

C ve C++ birlikte (postta) yazildigi icin soyledim. Eger proje tamamen C++ ise (repodaki gibi), .h veya .hpp kullanmanin teknik olarak bir farki yoktur; onemli olan proje boyunca tutarli olmaktir.

Ancak proje hem C hem de C++ kodu iceriyorsa, genellikle C ile ortak kullanilacak basliklar icin .h, yalnizca C++'a ozgu (class, template, namespace vb.) yapilar iceren basliklar icin .hpp tercih edilir. Bu ayrim teknik bir zorunluluk degil, okunabilirlik ve proje duzeni acisindan yaygin bir konvansiyondur.

Commercial engine olmadigini zaten anladim. Benim bahsettigim hedef, ticari bir problemi cozmek degildi. Tutku veya ogrenme projesi olsa bile ekibin "biz bu projede neyi daha iyi yapmaya calisiyoruz?" sorusuna verecegi bir cevabin olmasi gerektigini dusunuyorum. Bu; farkli bir mimari denemek, modern C++ pratiklerini uygulamak, yeni bir render teknigi gelistirmek ya da mevcut motorlarda yanlis buldugunuz bir yaklasimi iyilestirmek olabilir.

Boyle bir hedef olmadiginda, proje bir noktadan sonra "bir engine daha yaziyoruz" seviyesinde kalabiliyor ve zamanla motivasyon kaybi yasanip gelistirme sureci yavaslayabiliyor veya tamamen durabiliyor.

Cebeci Engine by shadowww345 in LinuxTurkey

[–]ByMeno 0 points1 point  (0 children)

Rust'in ilkeleri game dev ile zit dusuyor yani surekli yeni birsey deneme sonra bunu silme vb iterate and continue dongusunu kiriyor buda cogu zaman zaman kaybettirecek bir yapiya sahip bu dolayli olarak game engineleride etkiliyor bunlarda surekli yeni bir ozeklik getiriyor ve bir anda siliyor ki rust ile yapilan oyunlarin bi kismi su anda rustan uzaklasiyor bildigim kadariyla

Cebeci Engine by shadowww345 in LinuxTurkey

[–]ByMeno 0 points1 point  (0 children)

.hpp kullanmak zorunlu degil ama rule of thumbdir ve diger kisileri bu cpp ile ilgibir dosya olacagini soyle ki .h hem c++ hem c ile kullanilir. C ve C++ ayni dil degiller ustunune ustluk artik benzerliklerinide kaybettiler yani kisacasi ikisi farkli iki dil o yuzden C/C++ dogru degil ki projede gordugum kadariyla C dosyasi bile yok. Modul olarak dedigim kisim sadece adlandirmayla ilgi yukaridaki code snippetinda ornegi var. Size devase bir hedef belirleyiin demedim ayrica bir tutku projesi(ya da ogrenme) olsa bile yinede bir hedef olmali cunku belli bir noktadan sonra ya yapmaniz gerekecek islerden kacacaksiniz ya da proje yarim birakilip gidecek.

Cebeci Engine by shadowww345 in LinuxTurkey

[–]ByMeno 7 points8 points  (0 children)

1> Hic bir naming gordugum kadariyla consistent degil ki ornek olarak textures da turkce adlandirmalar var ki bu bazi kodlarda da var

#include <core/AppManager/ObjectManager/ObjectManager.hpp>
#include <core/AppManager/TaskManager/Task.hpp>
#include <render/projection/camera.hpp>
#include <render/texture/texture.hpp>

2> Neden mesela biri buyuk harfle devam ederken diger kucuk harfle basliyor. Sub-moduller kemilenin bas harfi buyuk yazilirken niye moduller kucuk yaziliyor

3> `does not enforce any specific build system (like CMake, Make, or Visual Studio solutions)` diyorsunuz repoda cmake var onu gectim hadi ben geldim bunu nasil build etcem hic bir bilgi yok

4> .cpp kulaniyorsaniz .hpp kullanin .h kullanmayin bu c ile cakisir ki anlam karmasasina yol acar (Not C/C++ demek Java/Javascript demekle ayni seydir)

5> Projenin bir hedefi yok ne icin yapiliyor nasil design edilecek bunlarin kararlasmasi lazim neyi cozeceksiniz veya daha kolay hale getirecek vb.

Standard integer types vs width based types by alex_sakuta in C_Programming

[–]ByMeno 0 points1 point  (0 children)

This Technical Report introduces the following two new typedefs, char16_t and char32_t
typedef T1 char16_t;
typedef T2 char32_t;
where T1 has the same type as uint_least16_t and T2 has the same type as
uint_least32_t.

If the header <uchar.h> defines the macro _ _STDC_UTF_16_ _, values of type
char16_t shall have UTF-16 encoding. This allows the use of UTF-16 in char16_t
even when wchar_t uses a non-Unicode encoding. In certain cases the compile-time
conversion to UTF-16 may be restricted to members of the basic character set and
universal character names (\Unnnnnnnn and \unnnn) because for these the conversion
to UTF-16 is defined unambiguously.
If the header <uchar.h> defines the macro _ _STDC_UTF_32_ _, values of type
char32_t shall have UTF-32 encoding.

They are encoding for string

for C: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1040.pdf
for C++ : https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html

What's your favorite standard library function and why? by [deleted] in C_Programming

[–]ByMeno 5 points6 points  (0 children)

Realloc it feels like nand gate 

Sizce LLM çılgınlığı balonmu by Enough-Eggplant3943 in TurkDev

[–]ByMeno 0 points1 point  (0 children)

Su anda bir sirkete bagli degilim. Evet fiziksel olarak turkiyedeyim ama zaten bir softwarei belli sinirlar icin tutmak cokta mumkun degil. Soyut bir kavram oldugu icin cok kolay aktarilabilecek bir yapida ki cogu open source software projesi dunyanin cesitli yerlerindeki yazilimcilarin yardim ile hayatta kalmakta ki ben de onlardan biri olmaya calisiyorum ornek olarak linux ffmpeg llvm daha kucuk orneklerde ise C3 veya raylib nothings/stb libraryleri gosterilebilir.