What are you working on, Sup Forums?

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/nothings/stb/blob/master/stb_c_lexer.h
duckduckgo.com/?q=python computer algebra system&t=ffsb&ia=web
streamable.com/c51cv
twitter.com/SFWRedditVideos

Rust shills not allowed

Good/bad for a new project?
audio.c 56 5 334
bmp.c 36 2 274
dg.c 39 0 268
draw.c 17 2 183
dg.h 7 1 169
font.c 9 3 162
batch.c 24 0 125
audio.h 15 7 118
util/mbf2pf.py 18 0 82
menu.h 9 7 73
camera.c 17 6 65
draw.h 16 4 62
vec.c 15 0 59
menu.c 18 9 54
mat.c 7 0 52
image.c 9 0 44
sprite.c 8 0 42
batch.h 9 3 38
bmp.h 12 1 37
rect.c 4 0 36
demo/menu/main.c 7 1 33
camera.h 7 0 31
vec.h 7 4 29
font.h 7 1 25
image.h 6 0 23
core.h 10 1 22
sprite.h 6 2 22
mat.h 3 0 10
rect.h 4 2 8
SUM: 402 61 2480

Do you think mozilla unsarcastically pay people to shitpost on the internet about rust?

Yes they spend on that instead of hiring more engineers

>TFW can't grok SICP Scheme

>Lisp
meme
Literally a language for brainlets so braindead they couldn't even implement a proper parser

Good for learning to make languages, but to actually use it for something or teach as a first is fucking retarded

>so many files for 402 lines of code
nigger just do everytyhing in main and once it grows big enough split it up, as it currently stands youll spend more time jumping between buffers than working on it

Oh? You wrote a C++ parser? Share with the class

>jumping between buffers than working on it
That's what IDEs are for, literally 2 clicks away.

I've refactored this from two huge dg.h (was like 300 lines of code) and dg.c (was like 2000) files.
Before I spent a fuckload of time each time I wanted to locate the function I wanted to edit, or a place to insert a new API function.

Now everything is a clearly defined module (actually they could be split even more, for example bmp could be split into bmp1D, bmp2D and bmp3D modules, and draw could be split into draw-core, texture, mesh, mesharray and so on), with defined dependencies and stuff.

It's all very ready for scaling, this will soon quadruple in size.

What IDE are you using?

>he jumps from one extreme to the other
C and Lua parsers are not that hard to make. A generic lexer is less than a thousand lines of code:
github.com/nothings/stb/blob/master/stb_c_lexer.h

Syntax has to help you to code. Most people think in an imperative and object-oriented way. The syntax has to reflect that instead of getting into your way.

>being this butthurt about lisp
Classic coping mechanism for brainlets who can't grasp something.

>That's what IDEs are for, literally 2 clicks away.
I realize that, I'm just saying that for such a minimal codebase it's still not worth the effort so early imo. But then you mention 2k loc so perhaps the SUM number wasn't telling me what I thought it was.

>they think language design is a competition about who can come up with the most bloated syntax and the most complicated parser
Daily reminder that you need zero IQ points to write an efficient parser. It's a purely mechanical process that can be done automatically by a computer.

>people think in object oriented style meme
Also, you realize that you can define your own syntax in lisp right? It's called a macro or something.

Was it Java or Matlab that did this to you?

>Was it Java or Matlab that did this to you?
cloc

which, by extension, is perl

You mean Rust since one should use tokei instead of cloc because it's a hundred times faster.

Why do people do this? Does creating empty files and giving them fancy names make you feel like you're making progress? Like the hard part of "sprite.c" is behind you?

>actually they could be split even more, for example bmp could be split into bmp1D, bmp2D and bmp3D modules
>C

Modularity, that's why.
Sprite.h and sprite.c operate on sprite arrays.
It can load, save a sprite array, extract a sprite, and it only depends on the core types (core.h) and libc, NOTHING else.
I call a corresponding header and source pair a module, that's my own terminology.
This is mostly Object-Oriented C, by the way
rect.h/rect.c operate on rectangles
font.h/font.c operate on my custom .polyfont files
camera.h/camera.c provides a 3D and 2D camera which only depends on the matrix module
and so on
Some of them are not object oriented, like draw.h/draw.c provides an abstract functions drawing API (NOT a renderer object or whatever) and all the objects that are tied to it (Texture, Mesh and so on, all classes that touch OpenGL (make buffer objects for example))

So yeah it was Java that did this to you.

how can I learn python in under an hour?

Never touched Java.

Anyway, show yours, non-OOP game engine.
I'll wait.

But why would do that?

>Modularity, that's why.
Splitting 400 lines of code into 40 files doesn't help "modularity" or anything else. It's just a waste of time. You can define all of these structures and functions in the same file and your code will be equally "modular" and equally easy to split up into files later on when you actually need to.

Well you certainly don't have a working prototype yet if it's an opengl project and that short. So congrats on masturbating over creating a bunch of almost empty files.

:^)

...

Knowing a programming language is just one part of the skill of programming, like knowing how to behave in a courtroom is just one part of being a lawyer. But that doesn't matter. If you want to make a game, make a game.

I need it to make my life easier for physics lab
I want to make a couple of scripts where I can just plug in measurements and get the results I need, so I don't have to use a dumb calculator
can python do partial derivatives?

dumb question, nvm I'll do the derivatives by hand

duckduckgo.com/?q=python computer algebra system&t=ffsb&ia=web

First, it is 2480 lines of code.
Secondly, it's projected to grow very soon and fast, because:
>there is ZERO error checking
>no assertions to document correct API use
>no documentation
>minimal viable product approach, a buch of stuff is potentially missing
Thirdly, it's better to do it early that later
I spent more time decoupling the older parts of the code than newer ones

Nice. I know you, you advertised this a couple months back.
Could you show your github repo?
>Well you certainly don't have a working prototype yet
That's where you're wrong, kiddo. I'm recording the gameplay of my game which was working when there we only ~1500 lines in the engine right now.
Currently it's being encoded. Just wait.

Surely showed me.

What are some *sane* webshit technologies? asp?

...

>it's projected to grow very soon and fast
The only thing about your toy that's projected to grow fast is the number of files.

>it's better to do it early that later
Nice assertion. Now back to reality: no, it isn't.

...

I have system programming on penguinOS this semester. Got me some lil handbook out of the library.
First halt will be exec-family

Does Visual Studio C++ hide any personal information in compiled EXEs?
Like MAC addresses, IP addresses, user name, ...

struct ParentStruct {
float baseValue;
};
struct ChildStructOne : public ParentStruct {
float valueOne;
};
struct ChildStructTwo : public ParentStruct {
float valueTwo;
};

void TestClass::Test()
{
ChildStructOne* firstTest = {};
firstTest->valueOne = 1;
ChildStructTwo* secondTest = {};
secondTest->valueTwo = 2;
PrintStructInfo(firstTest);
PrintStructInfo(secondTest);
}

void TestClass::PrintStructInfo(ParentStruct *theStruct)
{
ChildStructOne *oneTest = (ChildStructOne*) theStruct;
if (oneTest != NULL)
{
cout

dynamic_cast

Splitting it up early protects you from unintentionally coupling with other modules.
It's uploading right now
streamable.com/c51cv

>dynamic_cast
So this is the power of sepples

Sorry for the brainlet question but what kind of CS class do I need to implement a regex engine? I'm working on a program and I'd like it to be able to match pairs of files with a regex from user input. Should I take a compilers class or is that overkill?

just use a regexp lib, or just use c++ like a sane human being and the regex header

>what kind of CS class do I need to implement a regex engine?
Common sense one

>what kind of CS class do I need to implement a regex engine?
None. It's not that hard to figure out on your own if you use your fucking brain.

DONE
streamable.com/c51cv
>Well you certainly don't have a working prototype
WHAT NOW, HUH?
HAHAHAHA

>protects you from unintentionally coupling
How does one couple things "unintentionally"?

Which is a point against lisp, not in favor of it. Homoiconicity is frankly quite useless. The only DSL's that are easier to make in it are very basic lisplike DSL's, that occasionally turn out to be better implemented in terms of higher order functions.

Haskell/ML is imho much better suited for metaprogramming/code generation that is actually useful, i.e. parsing a custom DSL that can take any form, and generating output code of any form. Parser combinators make this ridiculously easy to do.

>:error: 'dynamic_cast': 'ParentStruct' is not a polymorphic type
>note: see declaration of 'ParentStruct'
>note: see reference to function template instantiation ChildStructOne .....

>xxdi.pl

If your class has no virtual functions or virtual base classes, use static_cast, otherwise use dynamic_cast.

For example, you make the default value to be suitable for both modules.
Draw module depends on batch module.
The batch module has a function to set the white pixel coordinate.
You can unintentionally couple both modules by setting the default value to {0.5, 0.5}.
This isn't technically coupling but when you change the default white pixel coordinate value in the draw module is going to be broken.
So yeah, unintentional coupling, a fine, subtle example that just happened to me.

It's easier to navigate too.

Are you using it behind a pointer?

>Which is a point against lisp, not in favor of it.
Only a moron would consider syntactic simplicity as a point against any language.

>Homoiconicity is frankly quite useless.
Only a moron would think that, too.

>The only DSL's that are easier to implement thanks to homoiconocity are the ones who make use of homoiconicity
Truly makes one ponder.

>very basic
Only a moron would think that lisp DSLs have to be "very basic" or somehow constrained.

>occasionally turn out to be better implemented in terms of higher order functions.
Only a moron would use macros for things that can be done using functions.

>Haskell/ML is imho much better suited for metaprogramming/code generation that is actually useful
Only a moron would think that Haskell or ML have any decent metaprogramming support. Everything about your post confirms that your butthurt about lisp is a defense mechanism to compensate for deep incompetence.

ChildStructOne* firstTest = {};
firstTest->valueOne = 1;
ChildStructTwo* secondTest = {};
secondTest->valueTwo = 2;


This won't work, by the way.

>literally speaks in meme terms
>"Truly makes you ponder"
Opinion discarded.

SML doesn't support macros, ocaml has very fucked up support for macros and is really ugly.

Homoiconicity is useless. Your AST doesn't have to be all lists to be first class.

>Only a moron would think that Haskell or ML have any decent metaprogramming support.
I don't know about ML but Haskell has monad/arrow syntax for EDSLs and parser combinators as well as Template Haskell.

Your problem stems from sloppy use of global variables, not from a lack of useless 10 line long files.

>utterly fails at making an argument
>turbo-deflection ensues
That was easy.

>Homoiconicity is useless.
Repeating a retarded assertion doesn't make it any less retarded.

>Your AST doesn't have to be all lists to be first class.
Nobody said it has to be all lists to be first class, or even that it has to be all lists to be homoiconic. Come back when you get at least a basic understanding of what you're talking about.

const correctness was mistake

>he thinks he made an argument by calling someone a moron

wrong

dumb sepples poster

>still fails to make an argument
>continues to deflect
Move on, kid.

It's a downcast so it crashes with static_cast
see my code I don't actually care if it works with or without a pointer. I am just trying to emulate a pattern I use in C# all the time:
>Have multiple different structs that are simple data containers
>Have them all implement the same blank interface
>Have a function that accepts the interface
>In that function I try to cast to each of the different structs to figure out which struct was passed
>Once I have that struct, I run a unique function on it

Show what you tried with dynamic_cast.

Besides, that's a stupid as fuck pattern and exactly what virtual methods are for.

So this is the power of sepples

posting here because more chance of you lads knowing this than people over at /sqt/

tl;dr mpv --ytdl not working in script run from firefox, works fine if script is run from terminal

>bash
disgusting

what would you have used

literally anything else
lua
python
perl
ruby
lisp

anything

>It's a downcast so it crashes with static_cast

No. See It's crashing because your pointers aren't pointing to a valid object.

Change those initializations from = {}; to = new ChildStructOne;//and Two

does it really matter if you just need to run two quick commands

void TestClass::PrintStructInfo(ParentStruct *theStruct)
{
ChildStructOne *oneTest = dynamic_cast (theStruct);

and I get the errors I wrote >Besides, that's a stupid as fuck pattern
Brainlet detected. Yes, I can accomplish the same thing with an overloaded function. However, if you weren't a brainlet, you would realize the logical extension of this is a function that takes an array of interfaces, effectively allowing me to pass through any combination of structs.

There's a hackathon at my uni. I want to go, but I have nobody to go with. Will I be the only one going who doesn't know anybody else?

Making sure we have smoke tests, as well as having prebuilt images for both new and old versions of a release. Last time we deployed it broke in prod because the staging datacenter isn't replicated.

Configuring builds and pipelines is about 80% of what I do now :/

Make sure to check if your Uni has a no singles policy.

struct Parent {
virtual void foo();
}

template
void many_foos(std::array objects) {
for (auto object : objects) {
object->foo();
}
}

That's not how dynamic dispatch works.

Did anyone write a random C++ type generator yet? I'm still waiting

Alright, so I did that and it actually compiles and doesn't crash, which is further than I've ever gotten.
The problem is
ChildStructOne *oneTest = (ChildStructOne*) theStruct;
if (oneTest != NULL)
{
cout

struct Child {
virtual string getType();
}

String tt = Child->getType();
switch (tt) {
case "":
etc
}


are you actually retarded

Now try dynamic_cast, but please stop being a retard and use virtual methods. If you ever have to use dynamic_cast, you have fucked up and you broke just about the only thing that works in OOP.

That's even worse.

struct ParentStruct {
float baseValue;
virtual ~ParentStruct(){}; //add this line to your parent struct
};


That's a virtual destructor so now the struct will be considered polymorphic and valid for dynamic casting.

ChildStructOne *oneTest = dynamic_cast(theStruct);
if (oneTest != NULL)
{
cout

Also, I didn't realize C++ required this because I'm not an idiot that uses dynamic_cast, but the other anons seem onto something when they say you need a virtual method at all to make it polymorphic.

>did 8 exercises from SICP last night
>only have two left before finishing chapter 3

I don't feel that enlightened guy. It has been good but I don't see what makes it better than a typical intro that would've been much more concise.

Which parts of the book are the most useful? Which will expand my brain the most?

Are streams useful to know about? What was with that ugly as fuck bit near the end of chapter 2 where you put shit in a table? How was that useful?

Why has the book ignored algorithms and barely touched on complexity?

Can I just stop and be a programmer while ignoring all cs education?

You fell for a Lisplet trap, you can stop and move on to a real language now.

>I can write Java in any language
lad...

>core types (core.h)
the core types are already keywords, no need to include any header

I don't think you know what scalable codebase means, user

No, you need
>vectors
>rectangles
>color types
>matrix type
>, ,

Wow it actually works. Basically, I need to add one virtual function for a class to act like an interface in any other language. Thanks.

Although I still think c++ is absolutely backwards for not having an "inferface" declaration

>only Java can be scalable
m8...