This is amazing. It's a shirt and a quick understanding guide.
Beej's Guide to C Programming (2007)
71–80 of 81 posts
Re: Beej's Guide to C Programming (2007)
#72Earlier quoted context omitted.
> "Nevertheless, I don't think anyone should call themselves a (true) programmer unless they know C." You could make an even stronger claim about knowing an assembly language. The point being that understanding how a computing device works is helpful in getting the best out of it. If that wasn't your point, then C is no more special than any other popular programming language. Also, whilst I only know the basics of C…
Any modern introduction to C should make heavy use of Valgrind at the very least. In addition to catching the nastiest class of bugs C programs are heir to, it can be used to teach how memory works at a low level.
Re: Beej's Guide to C Programming (2007)
#73Re: Beej's Guide to C Programming (2007)
#74Earlier quoted context omitted.
While C remains the single most important programming languages of all time, its share of popularity is shrinking, giving way to C++, C#, Java, and Swift (from Objective-C). Nevertheless, I don't think anyone should call themselves a (true) programmer unless they know C. C is easy to learn, because it's a small language. If you are not new to programming, pretty much all there is to know is in the second edition of t…
I've been using C# on a daily basis for ~2 years at this point. I've had that book on my wish list for awhile, but wasn't sure if I would make use of it - I'll likely order it soon.
After working through the problems, two books that would be great followups are Hanson's C Interfaces and Implementations and Bryant and O'Hallaron's Computer Systems: A Programmer's Perspective.
Re: Beej's Guide to C Programming (2007)
#75This is wonderful. I see that this guide is sort of "old news" to many of the experienced programmers hanging out here. But as someone who isn't that experienced and about to begin a course on Data Structures + Algorithms using C, this is amazing. Thank you.
Re: Beej's Guide to C Programming (2007)
#76Earlier quoted context omitted.
> Even today, if you were to create a brand new language, you'd likely write the compiler in C (or maybe C++). You might write the bootstrapping compiler in C for portability reasons, but you'd probably write the real compiler in the new language itself. Not to mention that if you don't mind the extra dependency on POSIX platforms you don't even need to write the bootstrapping one in C. For example, the Rust compiler…
If I remember correctly Go's first few compiler implementations were written in C, but later were written in Go (bootstrapped by C).
Re: Beej's Guide to C Programming (2007)
#77Earlier quoted context omitted.
> Are there any good tutorials for cross platform development with C++ on windows. Install QtCreator with MinGW. Here you can just compile your code and have it work. > You have to configure multiple files in multiple folders and multiple configuration entries. not on sane systems where you just do `apt-get install libsdl1.2-dev` or `pacman -S gtk` or `brew install qt boost`
I hear QtCreator mentioned on Hacker News quite frequently. A couple of questions, if you don't mind. 1) How well does it work if you are trying to stick to C and not go the C++ route? 2) They are GPL licensed, so not very permissive, or quite expensive for a commercial license. Is there a significant difference in feature set between the open source & commercial versions for someone that just wants to take it for a…
The IDE works fine, but you're missing on a lot :p. You can use raw makefiles or, better, CMake with it; the integration with cmake's server mode in the latest version is top notch.
> They are GPL licensed, so not very permissive, or quite expensive for a commercial license. Is there a significant difference in feature set between the open source & commercial versions for someone that just wants to take it for a spin?
First, there are two things: Qt and QtCreator. Qt is a C++ library (and also has its own DSL, QML which is a godsend to make modern UIs) and QtCreator is an IDE. While it has a lot of Qt-specific features (eg UI designer, some Qt-specific autocompletions, Qt examples on the front page), it can just be used as a general-purpose IDE for C, C++, Python, and Nim. As such, its license does not matter for you as a developer, unless you want to ship a product with the IDE (for instance Sailfish OS and Ubuntu used a customized QtCreator as the IDE for their respective SDK).
Then, Qt is as you saw, under multiple licenses: commercial, gpl, and lgpl.
* all the libraries are under GPL.
* most modules are additionnally under LGPL.
* two tools are only under the commercial license: QML compiler (but it has been superceded by another approach that was open-sourced) and pre-made images for some embedded boards (Boot2Qt, basically useful for embedded software that runs fullscreen just on top of the linux kernel with no GUI environment, generally on the raw framebuffers or drivers provided by the board vendor).
The things that are under GPL but not LGPL are here: http://doc.qt.io/qt-5/qtmodules.html#gpl-licensed-addons (three modules: virtual keyboard, charts and data visualization). Everything else on the page (ie more than enough for "taking it for a spin") can be used from proprietary apps (you have to make a readme at some point that says that you use Qt, like any other open source libs.) . The simplest is to just use the Qt shared libs, but you can also link them statically:
https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynami...
Re: Beej's Guide to C Programming (2007)
#78Earlier quoted context omitted.
I hear QtCreator mentioned on Hacker News quite frequently. A couple of questions, if you don't mind. 1) How well does it work if you are trying to stick to C and not go the C++ route? 2) They are GPL licensed, so not very permissive, or quite expensive for a commercial license. Is there a significant difference in feature set between the open source & commercial versions for someone that just wants to take it for a…
> How well does it work if you are trying to stick to C and not go the C++ route? The IDE works fine, but you're missing on a lot :p. You can use raw makefiles or, better, CMake with it; the integration with cmake's server mode in the latest version is top notch. > They are GPL licensed, so not very permissive, or quite expensive for a commercial license. Is there a significant difference in feature set between the o…
What advantages does QML provide over using "just the Qt library from C++"? Faster development? I've used an earlier version of Qt (3 or 4) a bit, but never tried QML.
Re: Beej's Guide to C Programming (2007)
#79Earlier quoted context omitted.
> How well does it work if you are trying to stick to C and not go the C++ route? The IDE works fine, but you're missing on a lot :p. You can use raw makefiles or, better, CMake with it; the integration with cmake's server mode in the latest version is top notch. > They are GPL licensed, so not very permissive, or quite expensive for a commercial license. Is there a significant difference in feature set between the o…
>QML which is a godsend to make modern UIs What advantages does QML provide over using "just the Qt library from C++"? Faster development? I've used an earlier version of Qt (3 or 4) a bit, but never tried QML.
e.g. when in "C++ Qt" you'd do :
connect(m_button, SIGNAL(clicked()), m_object, SLOT(on_clicked()));
or more recently connect(m_button, &QPushButton::clicked, m_object, &MyObj::on_clicked);
or even connect(m_button, &QPushButton::clicked, this, [=] { /* do stuff */ });
QML would be : Button {
onClicked: /* do stuff * /
}
Even better is stuff like connect(m_slider, &QSlider::valueChanged,
m_object, [=] (int val) { m_item->setWidth(3 * val) });
m_object->setWidth(3 * m_item->value());
which becomes Slider {
id: slider
}
Item {
width: 3 * slider.value
}
It has a slightly stronger type system than JS; not as strong as TypeScript though. The idea is that when you really need strong typing you do it in C++ and expose your objects to QML (which is a one-liner: every object part of the Qt meta-type system can be used from the QML's side and have its signals and slots called there).Of course, the big drawback is the performance loss that you get from going from optimizable C++ to Qt's modified V8 engine. However, if you had a graphics-heavy C++ Qt app that relied on QGraphicsScene / QGraphicsView it could be faster in QML since there it's all OpenGL / D3D12 (and hopefully Vulkan) + a modern scene graph, instead of CPU rendering. So like always, benchmark benchmark benchmark :)
Re: Beej's Guide to C Programming (2007)
#80Earlier quoted context omitted.
>> I've always been hesitant at many Project Euler problems since some of the math is off putting to me. That's why I consider building something (like a side project or something of use). Math has the nature of simplicity -- well defined and little complication, but abstract (or useless). If you like building things, I would suggest a text editor or a GUI layout engine. For the latter, think about an intuitive decla…
> If you like building things, I would suggest a text editor or a GUI layout engine. For the latter, think about an intuitive declarative way of describing layout (like HTML/CSS or TeX or Tk) then implement it on native win32 API or GTK. Focus on the simplicity and in-control aspect; do not get distracted by feature completeness. Both of these sound like great learning projects - but are they too far in the "deep end…
If you're OK with the dated context it's still applicable to modern Win32. You can find it used.