The Eternal C edition.
Previous thread:
The Eternal C edition.
Previous thread:
Other urls found in this thread:
youtu.be
herbsutter.com
vector-of-bool.github.io
reddit.com
bfgroup.github.io
medium.com
docs.python.org
en.wikipedia.org
en.wikipedia.org
lwn.net
twitter.com
anime is gay
C is most powerful programming language
whats the point of programming
What would be a good way to set up a command/binding system for a game?
I think thinking of having an "input state" that would either be "program", "typing", or "console", so whenever input is ran it gets handled accordingly.
If I make a game that has 2+ player support, would I make the "controller button" associated to an action be an array?
C and Rust are the most powerful programming languages.
What is the best language/engine for 2D indie game development? I know intermediate Python, but honestly it has almost nothing decent for making games.
Real Engine 4.
You could either scale both the positions and UVs by (multiplicationFactor + threshold/2) or you could just switch to drawing lines directly. Personally I would just use lines.
daily reminder this is the average c zealot on this board
don't be like this guy. don't be a cnile.
Well, for the positions you'd use ((multiplicationFactor + threshold/2) / multiplicationFactor).
youtu.be
Might be of interest.
>I'm thinking of having some input state
You need a way to distinguish console input from game input. The easiest method of suppressing game input depends on how you're doing game input but most likely
Very few consoles do anything but text input. So to me it seems more like you're looking at 'console' or 'game' as your states.
I don't follow what you mean when you're talking about 2+ player support.
Surely only one of them would do console input. Are you talking about gamepad console input? That's wild. I'm sure someone would love it though.
is javascript for retards?
I'm 99% sure that the C shills on this board are actually glowies trying to encourage the use of a programming language extremely prone to error and vulnerability especially in situtations where it isn't appropriate to use C so they can stockpile more exploits after the depletion from the Shadow Brokers/Vault 7 0day leaks/thefts.
Prove me wrong.
I love C.
I like Lisp.
> Personally I would just use lines
Yeah I'm experimenting with the frag shader. I have the code using lines for the grid ready
I'll try your idea tmr. Thanks again m8
This. Fuck off NSA.
I need a couple very simple tasks to stretch my legs in a new language
*Forth
I have minimal experience with computer programming, and I like to follow my father advice and learn C because I have nothing better to do in my life.
Book are the best way to learn programming. What is the best book to learn The C Programming langauge. I looked at a online pdf of the Ritche and Kernighan book and it was out of my league. So what is a good book the get started with?
t. brainlet
Rewrite one of your utilities in .
What cartoon?
write a yaml parser
make a lisp
program tetris using whatever GL bindings you have
It's a fan animation for the webcomic unsounded, which is very good
I program in C because it's simple and easy for a beginner
Why do people use Forth? What can one do with it?
Unlike C it's extremely flexible and very easy to implement. It's mostly used for embedded work.
All memeing about security problems with C aside, legitimately don't learn C from K&R. It's more of a reference (and it's pretty outdated and likely to teach you bad/unsafe habits)
Go with K. King's C: A Modern Approach which covers C99 instead. Pretty friendly for beginners and much closer to good practice than K&R
K&R is good as a reference though especially if you like want to learn the Unix/Linux kernel style of C.
What about Prata, man?
>c allows function pointers
>you can dynamically assign function pointers to variables
How is this not high level?
fags think that if you have to use malloc and free it's not high level.
you can do that in assembly language my dude
Assembly has functions?
jal $a
wa la, functions
assembly has code and code addressing
>tfw have to spend the day at work by making convoluted 2 page long sql queries to pull the relevant data from ten million tables with 10 millions parameters
just kill me
if i see one more join before i kick the bucket will be one too many
Someone please be leetcode practice buddy.
Give an example of data you're trying to find
It's too complex to explain simply, basically you have to join an ungodly amount of tables together before you can start pulling anything relevant out of them based on search parameters.
I can't believe they paid someone to design that shit. I can smell the poo all they way here.
>not writing 1000 line long queries
/a/, user,
Not Jow Forums,
/a/.
If you are going to troll, do it right.
Excuse my ignorance because I only have a little bit of database training. Would it just be something like (obviously not syntactically correct): select users from employees where employment date is older than 5 years and has certificate "example," and then joins these users with a table called, idk, experienced users?
Contact?
Do you have a preferred method of talking?
Could set up an IRC channel maybe
Ehh, kind of a pain. Rather use discord or something if you don't mind botnet. or just email.
Well all sql queries are just selects and wheres and shit.
It's the structure of the data that can make it complicated. Say you need to join 20 different tables together, but you also need to add several more dynamically constructed tables as well to the mix (basically select subqueries which have their own subqueries in them, subqueryception) and then you have to group that shit by certain parameters and filter it to remove certain unwanted entries and so on so forth and then you run the query and it doesn't even work and you finally neck yourself because you had enough and just don't care anymore
and then the next unlucky cunt gets hired and realizes you were too lazy to write any comments and he can't even neck himself because you used all of the rope and he just snaps and kills everyone in the building before cops take him finally down
and then the next guy gets hired and rinse and repeat
herbsutter.com
> *C++ manual grows another 500 pages*
Maybe I'm autistic but that seems really interesting
Good. The changes can be broadly described in the following terms.
>Necessary features
Modules
>Unnecessary but harmless features
Concepts
>New features that are complex to standardise but simple in practice because they're just generalizations of existing features
constexpr improvements
>library features
ranges and span
>Modules
Why?
People will use modules regardless.
Significantly improved compilation times, much more DRY, better encapsulation.
reddit.com
If concepts manage to produce better error messages, I'll be happy
Possibly but unlikely. You've been able to SFINAE since C++98 though so this is just syntax cleanup.
> Significantly improved compilation times
bfgroup.github.io
> With the limitations of the capabilities of current compilers one can only conclude that modular builds are very advantageous at lower parallelism levels environments. But that it’s unclear if they are an advantage in highly parallel build environments. In other words, that modules currently do not scale in the same ways as traditional compilation.
kek
Or IRC?
I don't understand how waiting for dependencies to be built is slower than every thread building dependencies independently. Is there that much overhead in communication between the threads?
I'm writing a gomoku ai agent.
What's the best way to check for consecutive lines of each colour? i.e. go over the top row and count how many consecutive lines of each white and black exist.
Monogame
what's a span?
Modules would have to be more than N times faster (where N is the number of cores) for it to beat traditional compilation.
An indexable pointer + size pair type. You'll be able to construct spans from C-style arrays, std::arrays, std::vectors, and so on.
Do yourself a favour, learn HLA.
I don't think I understand.
Header-style compilation should take N*M CPU time. If M compilation units import N headers then those N headers need to be compiled N*M times. Module compilation should be an N+M problem because the N headers are compiled once and then imported for negligible cost by each of the M compilation units.
Certainly each of those compilation units needs to stall and wait for their dependencies to be compiled first, which makes the real time gains much smaller than the CPU time gains - but I don't see how that could be any slower than each compilation unit compiling the dependency individually unless the de/serialization overhead is much greater than I thought.
Neat. Sounds like a useful feature that would have been nice many decades ago.
It's a basic feature I've had in my toolkit for a long time.
Why aren't you live streaming your daily coding sessions on twitch, user?
medium.com
Because you need titty to become a tittystreamer
I'm proficient in Perl and PHP. Should I learn Python too, and if I should, can you recommend any good books?
I am scraping data from HTML tables in order to do statistics. Not sure if I want to use R or pandas yet but I'm going for python to do the preprocessing.
Not so many data in volume, I can fit everything into RAM, but the structure is quite "complex".
Should I do straight into pandas or whatever and deal with the raw data from there or should I take the time to make a sqlite database and then deal with the data through requests?
She's not like that actually. I had a look. My impression is that it's a very casual stream in terms of volume of work being done but the content is solid.
>the content is solid
I prefer dry content
Based.
It depends on what your goal is. If you already know Perl and PHP then you're unlikely to have any big revelations from learning Python.
However, you can learn the basics of Python over the course of several days, so it can't hurt.
The official tutorial is a decent enough intro.
docs.python.org
>the basics
more like "all of it"
C programmer here who never makes mistakes like anyone with more than 2 brain cells.
I never let buffers overflow. I never use after free.
Why isn't anyone hiring me?
Their software would be 100% secure.
Instead they hire Rust trannies.
You never make mistakes but you don't provide guarantees.
Rust provides guarantees.
You can stop samefagging any time.
Fucking rustfags trying to ruin yet another /dpt/.
This is the kind of code that people who shit on OOP write.
typedef struct {
unsigned long pix;
XftColor rgb;
} Clr;
typedef struct {
Cursor cursor;
} Cur;
typedef struct {
Display *dpy;
int ascent;
int descent;
unsigned int h;
XftFont *xfont;
FcPattern *pattern;
} Fnt;
typedef struct {
Clr *fg;
Clr *bg;
Clr *border;
} ClrScheme;
typedef struct {
unsigned int w, h;
Display *dpy;
int screen;
Window root;
Drawable drawable;
GC gc;
ClrScheme *scheme;
size_t fontcount;
Fnt *fonts[DRW_FONT_CACHE_SIZE];
} Drw;
typedef struct {
unsigned int w;
unsigned int h;
} Extnts;
/* Drawable abstraction */
Drw *drw_create(Display *, int, Window, unsigned int, unsigned int);
void drw_resize(Drw *, unsigned int, unsigned int);
void drw_free(Drw *);
/* Fnt abstraction */
Fnt *drw_font_create(Drw *, const char *);
void drw_load_fonts(Drw *, const char *[], size_t);
void drw_font_free(Fnt *);
void drw_font_getexts(Fnt *, const char *, unsigned int, Extnts *);
unsigned int drw_font_getexts_width(Fnt *, const char *, unsigned int);
/* Colour abstraction */
Clr *drw_clr_create(Drw *, const char *);
void drw_clr_free(Clr *);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *, int);
void drw_cur_free(Drw *, Cur *);
/* Drawing context manipulation */
void drw_setfont(Drw *, Fnt *);
void drw_setscheme(Drw *, ClrScheme *);
/* Drawing functions */
void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int, int);
int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
/* Map functions */
void drw_map(Drw *, Window, int, int, unsigned int, unsigned int);
Totally NOT seeing an OO pattern here, right?
Also
>abstraction
>abstraction
>abstraction
Are they trying to convince the reader that those "abstractions" are effective, or themselves?
rust has no jobs
That is pretty standard procedural code.
What are you, retarded?
It's just OOP with uglier syntax
Yes, you're retarded.
you are just nigger with whiter skin
That's literally reinventing OOP, though.
Top kek. Where is this from?
t. 6 GB "you're using it wrong" pajeet
No it's not, you fucking moron. It's simply some data types and some functions.
Just to prove that you're not retarded, can you please give a definition for procedural programming and a definition for object-oriented programming?
Why aren't the data types immutable?
You have to use immutable data if you want to be a true OOP-hater.
Can you say that again, but in English?
not an argument
what exactly is different about turning all those free functions into methods apart from bikeshedding
no supiku anglais
Because I'm free to write a function which isn't so explicitly tied to a data type.
Procedural programming doesn't say you're not allowed to write functions which are like that.
en.wikipedia.org
>Procedural programming is a programming paradigm, derived from structured programming[citation needed], based upon the concept of the procedure call. Procedures, also known as routines, subroutines, or functions, simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself.
en.wikipedia.org
>Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated (objects have a notion of "this" or "self"). In OOP, computer programs are designed by making them out of objects that interact with one another. There is significant diversity of OOP languages, but the most popular ones are class-based, meaning that objects are instances of classes, which typically also determine their type.
Syntax aside, that code clearly resembles the second definition. You have functions that are tightly coupled with data, the only difference is that you are passing the structure explicitly.
And in case you didn't know, even Linux makes heavy use of OO: lwn.net
Learn to see past syntax.