3 ms·
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make
by Y_Y 2y ago
> It's impossible to do graphics in pure C, so what are the alternatives
Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages.
All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything;
> On two occasions I have been asked, — "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower, House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
- Passages from the Life of a Philosopher (1864), ch. 5 "Difference Engine No. 1"
Although I don't start new projects in C very often, I'm acutely aware how it's not turtles all the way down (as the logophiles believe), but rather C. With some infrequent exceptions the whole tower of abstraction was written in C. SDL is written in C, the compiler? C, the Linux kernel is written in C, the graphics driver was written in C, the GPU firmware was C. It might be unfeasible for you to get by without writing these yourself, but with enough C and somewhere to sit you can move the earth.
(Of course all projects have a smattering of other languages and with great effort you can bootstrap from Forth or handwrite assembly or whatever, but you can do it all in C, and very likely that's what happened.)
- mjburgess 2y agoThe idiot there is Babbage -- the politician, more well trained in general thinking, clearly observed that thinking-things can correct mistakes against a background of common understanding. eg., "Q. Who is the king of france?", "A. France has no king, did you mean who was the last king of france?"
- Y_Y 2y agoBut that's an input too (cf. contingent vs. necessary truth). If the Analytical Engine were controlled by an Orléaniste it would surely declare the balding[0] Count of Paris, Jean Carl Pierre Marie d'Orléans, to be king[1]. [0] https://files.osf.io/v1/resources/p4wqa/providers/osfstorage/5fbe2059ab6518013bb0f5cc?action=download&direct&version=1 https://files.osf.io/v1/resources/p4wqa/providers/osfstorage... [1] https://en.wikipedia.org/wiki/Succession_to_the_former_French_throne_(Orl%C3%A9anist) https://en.wikipedia.org/wiki/Succession_to_the_former_Frenc...
- sgarland 2y agoCalling Charles Babbage an idiot has to be peak HN.
- mjburgess 2y agoClearly raised to a higher peak by taking one of the words of a statement most easy to misread for the sake of outrage, and highlighting it, whilst ignoring the substance of the comment. Babbage was insulting politicians who had, in the instance of his insult, a better grasp on the nature of intelligence than he had. It is a foolish quote to repeat, and reeks of the same smug obliviousness in which it was said. If Babbage was fit to be so smug, he is fit to be called an idiot when having been so foolishly. "Peak HN" is presumably when you can cite an oblivious smarter-than-thou Engineer at his most inastute, but not call one an idiot.
- wzdd 2y ago> If Babbage was fit to be so smug, he is fit to be called an idiot Please become familiar with the British sense of humor and the context of the writing before taking it at face value. If that is too much work, at least be prepared to give the writer the benefit of the doubt. Babbage was writing for a specific audience and with a specific intent, and I would suggest that you are probably misunderstanding him if you are inferring smugness from an isolated quote.
- robinsonb5 2y agoYes indeed, if the project were targetting a simpler machine without an operating system and windowing system in the way, then doing the whole thing - graphics presentation and all - in a thousand lines of C would be perfectly feasible > I'm acutely aware how it's not turtles all the way down (as the logophiles believe) De Chelonian Mobile
- Y_Y 2y ago> De Chelonian Mobile Get out of here with that monotestudonist heresy!
- rileymat2 2y agoIt uses a sprite sheet png file. I am curious how you would target a simpler machine without a bunch of code to display those. I am having trouble picturing this.
- robinsonb5 2y agoThere's no special reason it has to PNG, though - if you're aiming for minimum line-count without dependencies then just use a raw bitmap.
- spookie 2y agoYou can just inline sprites in code too. Even though that would add at least one big line of code :) This is how I do fonts in one of my projects.
- jasode 2y ago>> It's impossible to do graphics in pure C, so what are the alternatives > I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. [...] , but you can do it all in C If you trace the actual context of the conversation from ggp (doubtfuluser - "SDL is not 1000 lines anymore") to gp (shric - "pure C") ... it is clear that "pure C" was just an imprecise and shorthand alternative to saying the more verbose "pure ISO C Standard C with no extra external libraries such as SDL". (I.e. https://www.iso-9899.info/wiki/The_Standard https://www.iso-9899.info/wiki/The_Standard ... has <stdio.h> and console printf() builtin there are no but no graphics and audio primitives) But people just quickly type things out that seem obvious in a particular discussion e.g. "pure C" ... but can't foresee 4d chess moves ahead in how others will misinterpret phrases like that, and then the pedantic correction guns come out blazing. <pedantic>But SDL _is_ "pure C".</pedantic> Yes, yes... I know. But one can just read gp's use of "pure C" with charity to see what he was trying to communicate.
- cv5005 2y agoSince FILE io is part if standard C I guess you could do a plan9-style interface where you fopen("framebuffer"); and fwrite() means writing a pixel value to the screen. Since io is always implementation defined anyway, it wouldnt be any less portable than when you do printf("some string") and 'expects to see a string somewhere'.
- Y_Y 2y agoPerhaps you're responding to the wrong person? I didn't think or write that GGP didn't know any of this. I was (clearly, I thought) considering the idea that someone might take such a position. I wouldn't even mention this, except that you've expressed a interest in avoiding misinterpretation.
- spookie 2y agoYou can do graphics in pure C though. Really, file i/o is all you need for anything. Anything.
- delta_p_delta_x 2y ago> Although I don't start new projects in C very often, I'm acutely aware how it's not turtles all the way down (as the logophiles believe), but rather C. With some infrequent exceptions the whole tower of abstraction was written in C. SDL is written in C, the compiler? C, the Linux kernel is written in C, the graphics driver was written in C, the GPU firmware was C. It might be unfeasible for you to get by without writing these yourself, but with enough C and somewhere to sit you can move the earth. This is a Linux-only situation. A significant fraction of systems code in Windows and macOS are written in fairly modern C++, including core system libraries and the kernel. A project that emerged out of Windows' C++ effort is the Windows Implementation Library[1]. I'm also certain Windows and macOS graphics drivers are written in C++. [1]: https://github.com/microsoft/wil https://github.com/microsoft/wil
- bryancoxwell 2y ago> with enough C and somewhere to sit you can move the earth Love this.