orosmatthew / hydrogen-cpp

A hobby programming language 🔥
MIT License
391 stars 38 forks source link

adding utils file and some swag to the compiler #4

Closed sbOogway closed 1 year ago

sbOogway commented 1 year ago

swagging 4evah. need to delete some includes

sbOogway commented 1 year ago

Looks like some real swag for sure. However it's not good to put all utilities in a single file. Maybe split it into lib/log.hpp (with a namespace called log -> log::error) and lib/time.hpp (without a namespace)

@Zedritsch thank u for the feedback bro, appreciate it

RedstoneWizard08 commented 1 year ago

I assume everyone knows about stdio.h and printf and stuff, why is nobody using it? Is there something wrong with it? Genuinely trying to learn here lol

sbOogway commented 1 year ago

@RedstoneWizard08 what u mean bruv?

zedritsch commented 1 year ago

I assume everyone knows about stdio.h and printf and stuff, why is nobody using it? Is there something wrong with it? Genuinely trying to learn here lol

@RedstoneWizard08 stdio.h is a part of the C standard library. Developers often prefer C++ equivalents (like iostream) as they are often more memory save and/or more compatible with other parts of the C++ standard library. Also, although C++ is a superset of C, there are a few cases in which C code does not compile in C++ as it would with a C compiler. So it's a good practice to deal with these languages separatly.

RedstoneWizard08 commented 1 year ago

Okay, that makes a lot of sense. I keep thinking of it like a JS/TS sort of relationship, where technically JS can be TS code, but TS is better. I guess C and C++ are a lot more different than I thought. This is why I like Rust lol. Only one way to do things normally. (Pretends str and String don't both exist.)

sbOogway commented 1 year ago

@orosmatthew bro take a look and do something

orosmatthew commented 1 year ago

Thanks for your enthusiasm for the project, but as of now I will not be accepting major pull requests to better keep in sync with the videos and things change quite drastically between videos. I will leave this open if I decide to change my mind in the future.

zedritsch commented 1 year ago

Okay, that makes a lot of sense. I keep thinking of it like a JS/TS sort of relationship, where technically JS can be TS code, but TS is better. I guess C and C++ are a lot more different than I thought. This is why I like Rust lol. Only one way to do things normally. (Pretends str and String don't both exist.)

I know it's been a few days, but I found a ressource that shows a really good example of the difference between C and C++: https://youtu.be/c-NyXKbqmQc?t=52