Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 148 KB, 850x1130, 1557609992887.jpg [View same] [iqdb] [saucenao] [google] [report]
71115789 No.71115789 [Reply] [Original] [archived.moe] [rbt]

Old thread: >>71108878

What are you working on, /g/?

>> No.71115804

First for fuck anime and j*pan.

>> No.71115807

>>71115789
No thanks for using an anime OP. First for Python is best language for productivity.

>> No.71115808

give me one reason to learn programming when i can just use the software some dweebs already pulled their hair out for

>> No.71115815

Actual first for fuck C fags and their cuckoldry

>> No.71115826

>>71115808
You sound too stupid to try to talk to

>> No.71115906

do think it's possible to make an ANN that can do abductive reasoning?
i don't know much about ANNs but from my limited knowledge i'm imagining a setup something like this:
>have three ANNs, A B and C, arranged in something like a GAN sort of way except the pipeline is three networks deep instead of two
>C is trained to take in a single hypothesis and a single point of evidence, and produce binary results, yes the evidence contradicts the hypothesis or no it does not
>B is trained to take in a single hypothesis and multiple points of evidence, and select multiple points of evidence that each independently contradict the hypothesis
>A is trained to take in multiple points of evidence and produce a single hypothesis that tries to explain it
>C is adversarial to B, B generates selections of contradictory evidence and C must verify that said evidence contradicts the hypothesis
>B is adversarial to A, A generates a hypothesis and B must verify the hypothesis is possible by failing to convince C that any contradiction exists in the evidence
could it work?
to reiterate, i'm not by any means claiming to be an expert, i'm just shitposting because i had an idea and i'm curious if it could work, by posting that idea i don't mean to try to imply i think i have the authority to declare it would work, in fact if i thought that then i wouldn't be asking.

>> No.71115907

why is there a new daily thread? the other one isn't even 24 hours old and isn't full, either.

>> No.71115950

>>71115907
/dpt/ is colonising /g/ to re-establish /prog/

>> No.71115971
File: 270 KB, 1351x4087, opengl code final final 2.png [View same] [iqdb] [saucenao] [google] [report]
71115971

Hey /g/ rate my code

>> No.71115978

>>71115971
>sepples
shit / 10

>> No.71115990

>>71115971
intermediate beginner -level

>> No.71116072

>>71115971
now add collisions, particles and animations

>> No.71116106
File: 56 KB, 769x1249, 45345.png [View same] [iqdb] [saucenao] [google] [report]
71116106

What the fuck does it want me to do?

>> No.71116121

>>71115971
>static const string shaderCode
just use a text file

>> No.71116126

>>71116106
Welcome to Rust.

>> No.71116143

>>71116126
The for-loop version works fine. This my first day with Rust, yeah.

>> No.71116149

>>71115971
You don't need to escape the newlines when they're outside the quotation marks.
You'd only need to do that if it were a #define or if you for some reason wanted it all inside one pair of quotation marks.

>> No.71116156

>>71115971
I'm traumatized by your curly brace/indentation style anon. i get that it's personal but you're not even consistently applying it as a rule. Some places have newlines and others don't.

That aside, your Walker can move faster diagonally than horizontally. According to the docs SFML has a trunc method which is probably what you want: https://github.com/SFML/SFML/wiki/Source:-2D-Vector-Manipulation

Ideally you should try to separate your rendering/mouse integration and simulation state more, red flags are having them in the same function like that.

>> No.71116159

>>71115789
New to computer programming. Just downloaded python to start some learning exercises. What text editor would /g/ recommend?

>> No.71116161
File: 772 KB, 1024x768, screencap-190526-004448.webm [View same] [iqdb] [saucenao] [google] [report]
71116161

wrote a callback registration interface for this stupid program so that the event loop is completely abstracted away like some widget toolkits

>> No.71116180

i'm getting into react native and electron. what do you guys think is a simple program that will teach me the important stuff that i can put on my resume?

so far i've just been tooling around and haven't made a real app. actually can't even decide what to make, seems like everything i need is already made

>> No.71116183

>>71116159
VS Code is the jack of all trades and easy to install/use
>>71116161
Nice project, are those white flecks in the original gif?

>> No.71116185

>>71116159
On Windows - sublime 3, visual code
Linux - mousepad

>> No.71116195

>>71116106
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html

>> No.71116201

>>71116156
I just moved from java to c++, maybe i need watch some youtube tutorials.

>> No.71116206

>>71116183
>are those white flecks in the original gif?
yes
so far gif images with partially changed frames works well, but some images don't have proper delay between frames so it must be assumed or in my case they don't animate

>> No.71116208

>>71116143
>>71116143
Well, I looked into it for you. You want to use .into_iter() instead of .iter().
Get used to deal with that garbage all of the time; that error message will be your new best friend.

>> No.71116216

>>71116180
You definitely have a hobby, aren't you? So make an app in this field. For instance, one of my hobbies are flags, maps, countries etc. so my first petproject mobile app was a flag quiz game lol.
If you still don't have any ideas, there are apps like
Weather (you can use openweathermap api)
Schedule
Also pay attention to technologies. E.g. use Typescript instead of JS, reuse components in case you make both mobile app on RN and desktop one on Electron

>> No.71116217

>>71116201
>java
Explains the everything-is-an-object design.

>> No.71116223

>>71116159
Use Russian IDE – PyCharm. It is great one.

>> No.71116225

What is the recommended workflow for working in psql? How do I efficiently write scripts in a text editor and then execute them inside of the repl?

>> No.71116229

>>71116208
Whoa, finally it works. Gotta look up the difference between the two. Thanks.

>> No.71116237

>>71115971
>using namespace
>std::string for a constant string
>not using raw string literals
>not using constexpr over static const where possible
>pass by mutable reference
>for lightweight objects
>with void return

>> No.71116258 [DELETED] 
File: 97 KB, 1395x797, question.png [View same] [iqdb] [saucenao] [google] [report]
71116258

I am autosaving every few seconds and I do it with a backgroundworker so that if it runs on crappy systems and the gamedata becomes large, it doesn't cause stuttering or any noticable effect for the player.

So to optimize, I create new BinaryFormatter() once and pass it to the backgroundworker's method with a tuple.

This is faster than doing a new BinaryFormatter() every few seconds, right? or is there something weird about passing stuff into another thread that I haven't foreseen?

Any other optimization tips?

>> No.71116264

>>71116208
>Get used to deal with that garbage all of the time;
ownership is hard, hopefully you don't program in c/c++ where fucking it up causes undefined behaviour

>> No.71116291

>>71116229
into_iter() is a "consuming iterator", meaning that whatever you're iterating over is no longer valid after you call it.
iter() is just a normal iterator and leaves the original array/vec intact.

>> No.71116294
File: 18 KB, 744x247, weeaboos.png [View same] [iqdb] [saucenao] [google] [report]
71116294

>>71115804
>>71115807
touhou isn't anime

>> No.71116298

>>71116264
undefined behavior isn't necessarily bad behavior, sometimes it's an optimization

>> No.71116314
File: 328 KB, 1280x800, 1431457553721.jpg [View same] [iqdb] [saucenao] [google] [report]
71116314

In java, why can't i access parent's private variables from subclass? It would seem intuitive to me, that subclass would be meant to inherit those as well.

I am not saying i could design better language than Oracle, i just wonder what is reasoning for this particular... quirk.

>> No.71116326

>>71116314
Use protected for that.

>> No.71116327

>>71116258
>or is there something weird about passing stuff into another thread that I haven't foreseen?
Do you copy the data or use locks or do you just accept data races?

>> No.71116337

>>71116314
otherwise you could break any form of encapsulation using inheritance
they're still there, just inaccessible
if you want members to be visible only to subclasses, use protected

>> No.71116345

>>71116314
Encapsulation is a shit.
Think first about testability (in case you aren't using Groovy in your unit tests where you can not give a fuck) over encapsulation

>> No.71116365

why does g++ always give Segmentation fault errors for invalid memory access? Why can't it just fuckin tell me in which line did I accessed my array out of index range?
fuck g++

>> No.71116369

>>71116365
contracts will solve this

>> No.71116371
File: 391 KB, 612x5733, 20120902.gif [View same] [iqdb] [saucenao] [google] [report]
71116371

>>71116326
>>71116337
>use protected
I know about it and i am going to do that. Just wondering what's the logic behind this.

>otherwise you could break any form of encapsulation using inheritance
Isn't that one of points of inheritance? It's not like you could break through encapsulation somewhere else to ancestor classes, no?

Or are ancestor classes often that different that they need protection?

>> No.71116378

>>71116216
i've actually been wondering about typescript

do we just have to rely on the typescript community to quickly push out a new version whenever there's a new feature in JS? are there any proposals for typing natively in JS?

>> No.71116388

>>71116365
lmao just use ASan/valgrind

>> No.71116391

>>71116371
i don't use java, but i think the point of inheritance is to inherit methods, but not the internal state

>> No.71116394

>>71116365
Compile with -ggdb -O0 and then run your program with:
gdb ./program
run


Then when it crashes you will get the call stack, variables, and such.

>> No.71116399

>>71116258
Ignore, a lot of it was pointless, re-did the whole thing. Actually don't have to pass it anything

>> No.71116404

>>71116161
very nice anon
>>71116294
this

>> No.71116412

>>71116225
you should use an ORM. i use sequelize. it's to the point where the app on its own only uses the ORM, and i use the psql shell to quickly verify if the record entered correctly, or to drop and reseed the database during testing.

i don't think many people add tables or rows in the psql shell, but it's good to know the syntax for it. you'd be surprised at the number of programmers that have never used their database's shell before

>> No.71116413
File: 450 KB, 1023x665, 1536373293308.jpg [View same] [iqdb] [saucenao] [google] [report]
71116413

>get drunk
>it slowly fades
>still somewhat dizzy but somehow energic and awake

Should I study / practice right now? It's also 3am

>> No.71116416

>>71116371
>Or are ancestor classes often that different that they need protection?
it's all good when you are the only one using the class, but lets say there other developers that may use it and of course they have no idea how to use it so they start changing the internal state of the superclass which may break everything. This is why you may want to hide that state from them and instead provide some kind of safe to use API.

>> No.71116441
File: 43 KB, 1200x606, CrOmEUvVMAE1_aW.jpg [View same] [iqdb] [saucenao] [google] [report]
71116441

>>71116413
do it anon

>> No.71116468

So i'm trying to make a text editor in Qt/qml.
But getting a textarea or a textedit in qml to behave like any normal text area is way more difficult than expected.
TextArea {
id: textEditor
objectName: "TextEditor"
Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: 5
selectByMouse: true
font.family: "Consolas"
font.pointSize: 10
}


The current stumble is it refuses to set the text cursor if i click where there is no text vertically. It works normally horizontally.

I can't tell if it's because the layout doesn't actually fill out the height or if the TextArea/TextEdit item is just shit. Setting the height property explicitly makes no difference.
Any pointers ?

>> No.71116470
File: 93 KB, 700x441, growth mindset.jpg [View same] [iqdb] [saucenao] [google] [report]
71116470

>>71116391
>>71116416
Ooh, i see. It kinda makes sense, now.
Thanks you all for answers!

>> No.71116474

>>71116468
>Any pointers ?
0xDEADBEEF

>> No.71116499

>>71116412
>you'd be surprised at the number of programmers that have never used their database's shell before
That's me, my database course was pure theory. I learned relational algebra and how to craft all of these intricate optimized queries but had no experience using it in a real database outside of a few homework assignments.

>> No.71116540

>>71115789
34 years later and still no unicode support in c++ std lib?
kind of amazing really

>> No.71116546

>>71116540
Based and ASCII pilled

>> No.71116550

>>71116540
ASCII is all you need.

>> No.71116578

>>71116540
Unicode is just sequence of bytes.

>> No.71116583

>>71116540
Isn't utf8 is implicitly supported by everything that doesn't autistically police that it is valid ascii ?

>> No.71116592

>>71116391
*protected static Foo foo; your path*

>> No.71116603

>>71115789
>What are you working on
I'm working on killing all of you pedo degenerates

>> No.71116624

>>71116540
aren't you always bitching about bloat

>> No.71116629
File: 1.68 MB, 332x332, 1558844505751.gif [View same] [iqdb] [saucenao] [google] [report]
71116629

Any opinions about Ibis vs SQLAlchemy vs ... ?

>> No.71116688

I have a C++ file structure like
src/
libA/
foo.cpp
foo.h
libB/
bar.cpp
bar.h
libC/
baz.cpp
baz.h

Each subdirectory is a library in cmake. I want the headers to be included like #include "libA/foo.h", which I have working. The problem is src/ is now my header include directory for every library. If I have libC has a dependency, now it can mistakenly include libA/foo.h which isn't linked. How can I fix this?

The only solution I can think of is to make the real file path src/libA/libA/foo.h (using a wrapper directory) so that they don't share a parent directory. But I don't like the look of that, is there a better way?

>> No.71116697

>>71116369
>>71116388
>>71116394
The problem needs to be fixed within g++. I do competitive programming as a hobby and all the online judges use g++. It's a nightmare to debug my code there, always have to copy paste / write my own utility functions and debug offline on my machine.

>> No.71116744

>>71116413
Alcohol is a depressant, so withdrawal from it causes stimulation.

>> No.71116746

>>71116378
You mean ES[9000] features?

>> No.71116749

>>71116697
Then pass the following to g++:
-fstack-protector-all -fsanitize=address,undefined

>> No.71116768

when does a c++ compiler add vtable to a class?
do they always have them?
are they added when inheriting from any other class?
or are they added when inheriting from a class containing at least one virtual function?

>> No.71116785

>>71116768
>do they always have them?
no, only if the class contains a virtual function
>are they added when inheriting from any other class?
>or are they added when inheriting from a class containing at least one virtual function?
the vtable pointer of the previous class is inherited along with the rest of its members if it contains virtual function, but an additional one isn't added unless the subclass declares its own virtual functions


all of this is implementation defined, but this is the only sensible way to do any of this

>> No.71116817

>>71116688
target_include_directories ?
best practice to use the target_XXX commands whenever possible

>> No.71116832

>>71116768
>when does a c++ compiler add vtable to a class?

it's much more fast than a hashmap (objective-c, python, ...) but static which is all right since c++ has no of dynamic features at all.

>> No.71116881

>>71116832
go to bed

>> No.71116942

>>71116881
https://cocoasamurai.blogspot.com/2010/01/understanding-objective-c-runtime.html

>> No.71116962
File: 854 KB, 3327x2881, 1524610287874.jpg [View same] [iqdb] [saucenao] [google] [report]
71116962

Let's say I have a python script that handles strings of LaTeX text. I want the script to cound how many instances of placeholder brakets {} are there, and use this info fill a given one or all with some string (or in alternative to replace {} with {something}). How can you do that?
Bonus: is there a way to keep track of depth, i.e. of there are brakets inside brakets inside brakets...

>> No.71116973

>>71116942
go to sleep
you answered a question that wasn't asked

>> No.71116983

>>71115789
I'm working on making up my mind what I want to work on.
Fourth week doing this.
Results: none

>> No.71116996

>>71116942
Obj-C is so cute T_T
Really missing when I used it at work

>> No.71117010

>>71116973
>you answered a question that wasn't asked
so what? are you in charge of this thread or something? you ain't shit, bro

>> No.71117029

>>71115807
https://www.youtube.com/watch?v=VSdnJDO-xdg

>> No.71117034
File: 642 KB, 1920x1080, scrot.png [View same] [iqdb] [saucenao] [google] [report]
71117034

>What are you working on /g/
Getting closer to getting my camera recording to work. I am still getting a segmentation fault in another process but at least my process isn't crashing :^)

>> No.71117039

>>71115971
it's too bright to look at

>> No.71117055

>>71116180
Make a website that helps people discover what it is they really need in their lives. Commercialize it. Make money.

>> No.71117060

>>71116996
Obj-C's object model is better than c++'s and faithful to smalltalk.

>> No.71117077

>>71117055
Dragon dildos? Just 301 to bad dragon's site.

>> No.71117085

>>71117034
>transparent terminal
oof

>> No.71117088

>>71116996
obj c manages the impressive task of making a language more ugly than C++

>> No.71117146

>>71117060
it's also way more inefficient than C++'s which begs the question of why it was added to C

>> No.71117193

>>71117088
What are examples of ugliness?

>> No.71117202
File: 648 KB, 935x1404, 1471763749124.jpg [View same] [iqdb] [saucenao] [google] [report]
71117202

>>71117193
ur mum m8

>> No.71117277

>>71117193
- (int)foo:(int)i
{
return [self bar:i];
}

>> No.71117307

>>71117277
god I had to deal with objective C years ago and even though I used it, I no longer have any idea what the hell this fucked up syntax means. I think that's like self->bar(i) in a sane language but the actual method signature with parameter names is a dictionary lookup, or something fucked up like that

>> No.71117308
File: 478 KB, 1200x1200, 1DA9267F-BE17-4108-ABCE-83107AD8840D.gif [View same] [iqdb] [saucenao] [google] [report]
71117308

I bought the book

>> No.71117320

>>71117202
8th grade finished? Nice.
>>71117277
Your arguments naming is shit.

>> No.71117322

>>71117277
maybe i'm just weird but i always found obj-c to be quite beautiful

>> No.71117334

>>71117322
It’s better than Go, that’s as much as I’ll give it.

>> No.71117336

>>71117202
fag
no one hates gays that much without being gay himself

>> No.71117338

>>71117077
that may work for you but not everyone wants the same lifestyle

>> No.71117343

>>71117322
I'm with you there.
I really, really like Objective-C and its emphasis on message passing.
I'm sad that Apple tanked the concept and the only free OpenStep implementation would be GNUStep.

>> No.71117350
File: 111 KB, 768x768, 1542482237387.jpg [View same] [iqdb] [saucenao] [google] [report]
71117350

>>71117202
That man is beautiful though

>> No.71117367

>>71117322
Yep it is a good metric of mental stability. Unstable one will scary SQUARE BRACKETS and will run for modern unreadable shit like Swift.
>>71117334
Even homeless' shit is better than Go.

>> No.71117380

>>71117343
the principles of message passing are good but trying to bolt a message passing language onto C did not result in anything like beautiful code.

>> No.71117382

>>71117336
True. I am gay and in fact dislike fags. Or maybe I feel that I can talk about it freely.

>> No.71117393

>>71117380
But it does make it extremely explicit. You could visually separate the "code" and "message" parts.

>> No.71117396

>>71117350
Yep I like handsome men of this age, would suck his dick and swallow the cum.

>> No.71117427

>>71117393
The square brackets would be enough to do that, all the other divergent syntax is just fluff for fluff's sake.

>> No.71117449

>>71117308
Congratulations!

>> No.71117575

Anyone doing PicoLisp? Are there some good e-books I should get?

>> No.71117579
File: 2.70 MB, 720x404, skilled.webm [View same] [iqdb] [saucenao] [google] [report]
71117579

/dpt/-chan, daisuki~

>>71117146
if you have five minutes to spare
https://youtu.be/TMuno5RZNeE?t=2107

>>71116365
It's not g++ but the operating system; Accessing an invalid memory address raises a kernel interruption
which then sends a signal (SIGSEGV) to the faulty process. It's your own fault for not catching that signal with a
customized handler.
http://man7.org/linux/man-pages/man7/signal.7.html

>>71116314
The point of an object, a data abstraction technique, is to hide the properties (data) behind a set of operations (interface).
The goal is to freed the developer from meaningless implementation details; you reason no more with data but with operations only.
An object shall always be aware of what happen with its properties; always rely on getters/setters. always.
Read Uncle Bob's trilogy.
https://en.wikipedia.org/wiki/SOLID


>>71116180
>a simple program that will teach me the important stuff that i can put on my resume
Anything relying on a database. A TODO manager, for example.

>>71116180
https://josephg.com/blog/electron-is-flash-for-the-desktop/

>>71116161
Is that haiku?

>>71115971
Why the _NOEXCEPT macro?

>>71115907
[daily programming] thread is about your daily programming. not to be confused with the programming [daily thread] which doesn't exist yet.

>>71115808
https://www.businessinsider.com/rest-and-vest-millionaire-engineers-who-barely-work-silicon-valley-2017-7

>>71115789
Thank you for using an anime image.

>> No.71117603

>>71117579
>Bob Martin
Stopped listening straight away.

>> No.71117631

>>71117579
>The point of an object, a data abstraction technique, is to hide the properties (data) behind a set of operations (interface).
I get that. It just seemed to me that members of one family can trust each other, no? I mean, that's what family's about!

>> No.71117653

>>71117579
Fuck off

>> No.71117713

>>71117579
fuck off

>> No.71117765

>>71117579
kys

>> No.71117862

>>71116159
Okay I downloaded sublime but I just changed the basic color scheme may download some extensions after googling that did all the customization.

My questions is what do I need to make windows 10 a nice development environment?

>> No.71117998

>>71116106
>>71116126
https://users.rust-lang.org/t/rust-koans/2408

>> No.71118020

>>71117862
Download development utilities and make sure they are a part of your PATH environment variable.

>> No.71118082

Faggot.h
#ifndef FAGGOT_H
#define FAGGOT_H


class Faggot
{
public:
Faggot();
virtual ~Faggot();

static float getGays(int index);
static void setGays(int index, float gay);

protected:

private:
static bool gay1[20];
static float gay2[20];
};

#endif // FAGGOT_H


Faggot.cpp
#include "Faggot.h"

Faggot::Faggot()
{
//ctor
}

float Faggot::getGays(int index)
{
if (gay1[index] == true)
return gay2[index];
}

void Faggot::setGays(int index, float gay)
{
gay1[index] = true;
gay2[index] = gay;
}

Faggot::~Faggot()
{
//dtor
}


>undefined reference to 'Faggot::gay1'
>undefined reference to 'Faggot::gay2'

why?

>> No.71118096

>>71118082
you need to declare them in faggot.cpp

>> No.71118116

>>71118020
im just downloading arch linux. i like using the wm so i can til things nicely. idk windows just feels to point and click no package manager, terrible shell, if im going to learn programming at least a decent environment to work with.

>> No.71118118

>>71117579
good video

>> No.71118123

>>71118082
https://isocpp.org/wiki/faq/ctors#link-errs-static-data-mems

>> No.71118127

>>71116264
>what are smart pointers

>> No.71118160
File: 2.74 MB, 720x405, sa.webm [View same] [iqdb] [saucenao] [google] [report]
71118160

>>71118082
you only have declared gay1 and gay2, you also have to provide a definition.

bool Faggot::gay1[20];

>>71117765
>>71117713
>>71117653
Please, don't bully.

>>71117631
protected variables are prone to violate the SOLID principles and discursive to the agile manifesto.

>>71117603
your reply really saddened me.

>> No.71118169

>>71118160
Fuck off

>> No.71118185

>>71117579
>>71118160
good posts as usual senpai

>> No.71118187

>>71118096
>>71118160
danke

>> No.71118189

>>71118160
>Please, don't bully.
You deserve nothing else, disugsting pedo scum.

>> No.71118201

>>71118169
you are nigger

>> No.71118214

>>71118189
Liking cute girls is not the reason he's cancerous.
He's fucking cancerous because he replies to everyone in the thread in a single fucking big post.
Attention whoring faggots can fuck off. Almost as bad as namefags.

>> No.71118218
File: 2.94 MB, 852x480, loli.webm [View same] [iqdb] [saucenao] [google] [report]
71118218

>>71118189
anime is not pedophilia, it doesn't involve real persons.

>> No.71118237

>2019
>tcc still doesn't support C11 atomics
>glibc only started supporting C11 threads in version 2.28
Why is compiler/libc support for C so poor?

>> No.71118243

>>71118185
nigger

>> No.71118257
File: 39 KB, 504x504, 1499515871665.jpg [View same] [iqdb] [saucenao] [google] [report]
71118257

>>71116468
This was either a bug in Qt or a retarded limitation; The TextArea is within a StackLayout, which was anchored from my tab bar to the bottom of the window using
anchors.bottom: window.bottom

This works fine for a TextArea item i'm using to display line numbers, but apparently not for a StackLayout.
Changing it to
anchors.bottom: parent.bottom

fixed the issue. which makes no sense since the window IS the parent.

>> No.71118260

>>71118237
No one cares about C.
Meanwhile, GCC is already working on C++ libs/features that aren't even fully standardized yet.
See: networking library, modules, coroutines.

>> No.71118272

>>71118260
>>71118237
C is a deadlang, C++ replaced it.

>> No.71118283

>>71118237
c11's thread api had flaws and we already have posix threads.

>> No.71118294

>>71118260
>>71118272
>C is a deadlang, C++ replaced it.
It did not.
>No one cares about C.
>Meanwhile, GCC is already working on C++
GCC also implemented new C features right away but my point is about other compilers. You can't really compile c++ with anything else gcc and clang anyways so it's compiler support also sucks.

>> No.71118298

Lisp is the most powerful programming language.

>> No.71118326
File: 699 KB, 1920x1080, scrot.png [View same] [iqdb] [saucenao] [google] [report]
71118326

>>71118127
>>what are smart pointers
I wish I knew how to smart pointer

>> No.71118336

>>71118237
>Why is compiler/libc support for C so poor?
You've got some balls to say that, Cnile.
Reminds me of a certain tribe crying about oppression when they are overrepresented.

>> No.71118341

>>71118294
how long did it take anyone to support c11 again?

>> No.71118400

With new C++20 class-type non-type template parameters, you can now make your symbols look like this:
_Z3fooIJXtl3FooEELi3EXtlSt5arrayIfLm3EEtlA3_fLf3f800000ELf40000000ELf40400000EEEEEESt8optionalIS0_Ev

>> No.71118416

>>71118400
How else would you serialise class types as symbols?
Actually, does the Itanium ABI comment on this at all?

>> No.71118422

>>71118400
it's about time!

>> No.71118426

>>71118237
Use pthread or a more sensible model for concurrency, like channels.

>> No.71118445

>>71118416
I'm just poking fun.

>> No.71118505

>>71118341
PellesC has had it since 2012.

>> No.71118741

>>71115804
mega based

>> No.71118745
File: 642 KB, 1920x1080, scrot.png [View same] [iqdb] [saucenao] [google] [report]
71118745

>What are you working on, /g/?
Working on this program to send camera data over a TCP connection. I figured out how to create a fake surface and now I have no segmentation faults. Progress for today. Feels like I am getting close to seeing some data.

>> No.71118765

>>71118160
holy shit this bitch did seppuku wtf why

>> No.71118785

>>71116106
Replace .iter() with .into_iter().

>> No.71118789

I'm randomly adding tiles to a path finding algorithm, and I don't want to visit the same tile twice. From what I understand the most common structure to hold the tiles I've already visited is a hashset, right? Any faster/more efficient alternatives?

>> No.71118790

>>71118765
>He hasn't seen Yuuki Yuuna before

>> No.71118869

>>71118790
Don't encourage him.

>> No.71118912

>>71118160
I want to touch that soft belly.

>> No.71118930

>>71118298
Clojure.

>> No.71118936

>>71118930
That's a LISP.

>> No.71118942

>>71118400
Just scrub your symbols from the executable lmao

>> No.71118943

>>71118160
Extremely sexy video

>> No.71118956

>>71118936
Yep. Btw dynamic typing makes me sad.

>> No.71118981

Imagine object lisp with static typing.

>> No.71119004

>>71118956
Why though? You can enforce type checks in say, Common Lisp if you want.

>> No.71119007

>>71118981
Lisp already has object system.
Lisp with static typing would be ATS.

>> No.71119016

>>71119004
type hinting in common lisp is way too fucking verbose.
Having static typing with type inference would be best

>> No.71119019

>>71118981
ML would like a word with you.

>> No.71119026

>>71118400
Looks based to me

>> No.71119036

>>71118257
Does the window have id: window?

>> No.71119038

>>71118936
it's not a lisp; lacks almost all Lisp primitives.

>>71118981
racket

>> No.71119050

>>71119019
SML or ocaml might seem fine but neither has macros (ocaml has with external extensions).
Both have shitty implementations, all of them have GIL.
SML doesn't have standardized C interface, though mlton has nice API, it's not portable.

>> No.71119054

>>71119016
Write a new language in CL that infers types, it's easy. /s
Carp looks interesting, it has type inference and ownership semantics:
https://github.com/carp-lang/Carp

>> No.71119055

Not used java for very long, are the value type/reference type rules similar to they are in C#? Will:
final int[][] foo = new int[2][800];
initialise all the members of all the arrays to 0 automatically?

>> No.71119084

>>71119055
Yes and yes.

>> No.71119086

>>71119055
Java went full retard with value types but this code will work.

>> No.71119091

>>71118789
>Any faster/more efficient alternatives?
You can do pathfinding with zero memory allocation. You store all the data for the pathfinding search in the tile itself. The open list is stored via an inline linked list. The closed set is represented like this: You have a global Generation variable which you add 1 every time you start the pathfnding algorithm, each tile has a ClosedAt variable, when you close the tile, set it to Generation, to check if it's in the closed set you just check if the variables are equal. Make it a 64 bit unsigned int and it won't overflow for a few billion years. This might be considered hacky, but it's the fastest way to do it

>> No.71119094
File: 80 KB, 691x328, in-out-02.png [View same] [iqdb] [saucenao] [google] [report]
71119094

https://www.wolfram.com/engine/

Thoughts? Apparently you can use this with a Jupyter interface.

>> No.71119108

>>71119086
In what way did they go full retard?

>> No.71119109

>>71119004
Yep, I heard about spec or like that for Clojure

>> No.71119112

>>71119091
How is it fast? If I have hundreds of thousands of tiles total I'd have to iterate over all of them to check their properties rather than just a small subest from the path. Wouldn't it be better to have a pre-allocated pool for path nodes with a maximum depth instead?

>> No.71119126

>>71119108
they didn't, it's c# which went full retard by trying to have it both ways

>> No.71119145

>>71119108
Basically they are second class citizen. You'll notice as you go.
>>71119126
Autoboxing seems sane to me.

>> No.71119149

>>71119109
* (defun checked-double (x)
(declare (type integer x))
(* 2 x))
CHECKED-DOUBLE
* (checked-double 3)
6
* (checked-double "hello")

debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {10005185B3}>:
The value
"hello"
is not of type
INTEGER
when binding X

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.

(CHECKED-DOUBLE "hello") [external]
source: (SB-INT:NAMED-LAMBDA CHECKED-DOUBLE
(X)
(DECLARE (TYPE INTEGER X))
(BLOCK CHECKED-DOUBLE (* 2 X)))
0]
*

>> No.71119166

>>71119149
Thx m8

>> No.71119167

>>71119149
(declare)
is optional feature and compiler is allowed to ignore it.

>> No.71119174

>>71119145
Autoboxing is dumb in Java and especially in C#.

>> No.71119189

>>71119112
well the inline linked list is the set, you just sort it as you build it if you want to. You could have a preallocated set, but then it'd be in a different place in memory than the node itself so slightly slower
The important part is doing the generation counting thing so instead of some big closed set all you have to do is add a single number and not have to look up anything

>> No.71119203

>>71119174
>>71119145
Going to read up on the boxing differences now, thanks.

>> No.71119235
File: 67 KB, 1920x1050, 1546191003697.png [View same] [iqdb] [saucenao] [google] [report]
71119235

>>71115789
Hey guys, functional brainlet here. Want to try my hand at some Scala, so I started going through pic related and am trying to write the program in Scala.
Here's some code for the parser that's stumped me:
type Lexer struct {
input string
position int // current position in input (points to current char)
readPosition int // current reading position in input (after current char)
ch byte // current char under examination
}

func (l *Lexer) readChar() {
if l.readPosition >= len(l.input) {
l.ch = 0
} else {
l.ch = l.input[l.readPosition]
}
l.position = l.readPosition
l.readPosition += 1
}


I want to write the Lexer class using Scala case classes and keep it as functional as possible. What's the best way to do it?
I know the easiest way would be just to use var members, but I want to keep them as vals. What do?

>> No.71119250

>>71115789
i wanna lick cirnos icicles

>> No.71119263

>>71115789
def RecursiveFactorial(n, x):
if x == 1:
return n

n = n*x
x = x-1
RecursiveFactorial(n, x)
print(RecursiveFactorial(4, 3))


why it return none and not the factorial?

>> No.71119276
File: 65 KB, 367x306, 8ca.jpg [View same] [iqdb] [saucenao] [google] [report]
71119276

>two of the most competent people leave the team
>stuck with chronic smoker and someone with incomprehensible English
This will be a great release :)

>> No.71119277
File: 203 KB, 1060x852, 1532435073652.jpg [View same] [iqdb] [saucenao] [google] [report]
71119277

SQL fuckery. So there's a table of people made from different sources, there are many duplicate rows but some have more data than the others, like one row will have a full place of birth but only the year of birth, and the other will have the full date of birth but no date of birth at all. The task is to remove the duplicate values but keep the from them. Same people are not marked as such so it's all approximate. So I made a custom aggregate function that picks the longest value from a column but realized that to merge people with a complete and an incomplete date of birth I'd have to group all people by year of birth which is fucking dumb and obviously wrong. Also tried joining the table on itself but that only works correctly if there's exactly one duplicate row. Now I'm stumped.

>> No.71119280

>>71119167
It's implementation defined if it does anything, good implementations do use it for optimisation.
For example, SBCL will use a shift instead of a function call with the declare.
* (disassemble (symbol-function 'checked-double))
; disassembly for CHECKED-DOUBLE
; Size: 33 bytes. Origin: #x52FD2EE6
; EE6: 498B4560 MOV RAX, [R13+96] ; no-arg-parsing entry point
; thread.binding-stack-pointer
; EEA: 488945F8 MOV [RBP-8], RAX
; EEE: 488BD3 MOV RDX, RBX
; EF1: BF02000000 MOV EDI, 2
; EF6: B904000000 MOV ECX, 4
; EFB: FF7508 PUSH QWORD PTR [RBP+8]
; EFE: B858C8AD52 MOV EAX, #x52ADC858 ; #<FDEFN ASH>
; F03: FFE0 JMP RAX
; F05: CC0F BREAK 15 ; Invalid argument count trap
NIL
* (defun unchecked-double (x) (* 2 x))
UNCHECKED-DOUBLE
* (disassemble (symbol-function 'unchecked-double))
; disassembly for UNCHECKED-DOUBLE
; Size: 35 bytes. Origin: #x52FD3FC4
; C4: 498B5D60 MOV RBX, [R13+96] ; no-arg-parsing entry point
; thread.binding-stack-pointer
; C8: 48895DF8 MOV [RBP-8], RBX
; CC: BF04000000 MOV EDI, 4
; D1: 488BD6 MOV RDX, RSI
; D4: FF1425C0001052 CALL QWORD PTR [#x521000C0] ; GENERIC-*
; DB: 488B75F0 MOV RSI, [RBP-16]
; DF: 488BE5 MOV RSP, RBP
; E2: F8 CLC
; E3: 5D POP RBP
; E4: C3 RET
; E5: CC0F BREAK 15 ; Invalid argument count trap
NIL

>> No.71119285

abusing overloading for shits and giggles

>> No.71119287

>>71119263
>python
found your problem
also you should
return RecursiveFactorial(n, x)

>> No.71119290

>>71119277
*but no place of birth at all

>> No.71119310

>>71119235
monads unironically (or you could do the plumbing yourself)
you probably want to separate the input since it won't "change", but you can return a new lexer state in your lexing functions and then chain them together

>> No.71119314

>>71119263
The outermost recursion layer lacks a return statement. Modify it so that the if x==1 block also has an else statement

>> No.71119358

>>71119314
def RecursiveFactorial(n, x):
if x == 1:
return n
else:
n = n*x
x = x-1
return RecursiveFactorial(n, x)
number = int(input('enter number for factorial: '))
print(RecursiveFactorial(number, number-1))


thanks it worked

>> No.71119361

>>71119036
yes,
like i said it works fine for the TextArea i'm using for my line numbers.

right now though i'm realizing i've probably wasted my time and i might have to use another approach altogether because the TextArea's performance is amazingly shit at even modest (~1000) line counts.

>> No.71119400

>>71115906
try it and report back

>> No.71119422
File: 271 KB, 900x900, plastic river.png [View same] [iqdb] [saucenao] [google] [report]
71119422

eta lang for android when

>> No.71119464

>>71119235
>>71119310
e.g. (haskell)
data LexerState = LexerState Int -- simple example, just the current position
data LexerError = LexerErrorEOI -- just unexpected end of input
newtype Lexing a = Lexing (Text -> LexerState -> Either LexerError (LexerState, a))
-- (Lexing a) consists of a function from (Text, LexerState) to (LexerState, a) that can fail with LexerError
-- (Lexing a) will represent a "lexing procedure" that produces a result of type a

-- todo, monad instance for lexing, including
-- return :: a -> Lexing a
-- (>>=) :: Lexing a -> (a -> Lexing b) -> Lexing b

-- lex a single character, failing if the input has ended
lexCh :: Lexing Char
lexCh = Lexing (\str (LexerState pos) ->
if Data.Text.length str <= pos then
Left LexerErrorEOI -- fail with end of input
else
Right (LexerState (pos + 1), Data.Text.index str pos) -- succeed by incrementing the position and returning the char at that position
)

>> No.71119518

>>71119464
then you'd use the monad instance like this
-- build a bigger lexing procedure out of smaller ones
lexWeird :: Lexing Char
lexWeird = do
c1 <- lexCh -- read a char into c1
c2 <- lexCh -- read a char into c2
if c1 == c2 then -- if they're equal
lexCh -- read another char (this will be the overall result)
else -- otherwise
return 'X' -- do nothing else and just give back 'X' as the result

in do notation, x <- y; z translates into y >>= \x -> z

>> No.71119523

>>71115789
(defmacro typed-let (bindings &body body)
(let ((let-bindings (loop for binding in bindings
for (name type value) = binding
collect `(,name ,value)))
(declarations (loop for binding in bindings
for (name type value) = binding
when (null value)
collect `(type null ,name)
else
collect `(type ,type ,name))))
`(let ,let-bindings
(declare ,@declarations)
,@body)))

>> No.71119539

>>71119094
Haven't read about it, but one of my issues with Mathematica has always been that it forces me to use their editor, as well as super annoying licensing terms. (I have one license from uni, but licenses are tied to computers and not accounts so I can't use it on my laptop in school, then on my desktop at home without massive hassle).

So this seems nice. Still a bit hesitant, but the language has many things going for it.

>> No.71119648
File: 61 KB, 735x710, Screenshot from 2019-05-26 09-48-43.png [View same] [iqdb] [saucenao] [google] [report]
71119648

>>71119539
You've been able to use a normal text editor for a while now, but why would you? The notebook interface is vastly superior and allows for nice typesetting and fancy input/output formatting.

>> No.71119731

>>71115789
thinking of developing a simple Qt application that doesn't crash like Kamoso. Is this doable with beginner-intermediate c/c++ knowledge?

>> No.71119734

>>71119648
>You've been able to use a normal text editor for a while now,
oh, I did not know that!

>why would you?
I am addicted to spacemacs, which should work just fine with the notebook format desu.

>> No.71119755

I want to loop over the contents of a SIMD vector. How?
Sometimes, I can just do
for (int i = 0; i < 4; i++)
__mm256_extract_epi64(v, i);

But this doesn't always work, because it can't always identify i as constant.

Is there some method to the madness?

A "completely unrelated" question:
Is there any way to force macro parameter substitution for its inputs?
e.g.
#define A(x, ...) ...
int k = A(76, f(asdasd, x, 0xFF));
// to become
int k = f(asdasd, 76, 0xFF);

I know I can pass in a macro to a macro, but that's a bit bulky.

>> No.71119820

>>71119755
just wrap the intrinsic in a (static inline) function that uses switch/case

>> No.71119916

>>71119820
No, that's ugly too.

>> No.71119948

>>71119916
calling the function is no more ugly than calling the intrinsic

>> No.71119992

>>71119755
In theory you can just cast it to a float array, but you'll have to convince the compiler somehow to not cause undefined behaviour.

>> No.71120033

>>71119948
Oh, you mean like that. Yeah, that could work.
>>71119992
It's in an XMM register, so that won't work.

Eh, I'll just integrate a switch statement.

>> No.71120044

I know it's not strictly /dpt/ related but can anyone helm me answer/decipher this question?

>In the lexical analyser, which 2 patterns differ from the lexemes which they match?

>> No.71120071

>>71119235
I'd recommend reading the original paper on parser combinators (it's not that difficult):
http://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf
try implementing those by hand, then read about scala's util.parsing.combinator

>> No.71120115

>>71117579
as an end user using g++ it is not my fault that g++ doesn't by itself handle the kernel interrupt when most of other compilers and languages do.

>> No.71120140

>>71120033
>It's in an XMM register, so that won't work.
You can't really say that since you're using C and not assembly. Obviously SIMD types can be stored in memory where you are free to access them as arrays.

>> No.71120200

>>71120044
My best guess is, which two of the patterns that make up your lexical analyser are not simple string matches?
I.e.
while {return Tokens::WHILE;}

is a simple string match because it just compares strings and the pattern and the lexeme will not differ (they're both "while").
meanwhile, the pattern for a number won't match
\d+ {return Tokens::INTEGER_LITERAL;}

because "\d+" differs from "1234"

>> No.71120396
File: 46 KB, 462x500, 1558295247333.jpg [View same] [iqdb] [saucenao] [google] [report]
71120396

Do you guys have a Master's degree?

>> No.71120418

>>71120396
i dropped out of high school

>> No.71120422

what do you guys think of the Godot source engine?

>> No.71120423
File: 226 KB, 563x651, when you don't even have your bachelors yet.jpg [View same] [iqdb] [saucenao] [google] [report]
71120423

>>71120396
Hopefully in a few years

>> No.71120434

>>71120422
half-baked and not fit for use by others, like most open source projects

>> No.71120439

>>71120396
Yes

And i'm still oblivious

>> No.71120446

>>71120396
Bachelors degree

>> No.71120447

>>71120200
I see, that could be it. Thanks.

>> No.71120464

>>71120396
I do

>> No.71120475

>>71120396
Give it two years.

>> No.71120493

remove CS fags from this thread

>> No.71120516

>>71120396
I have an associates degree, never cared to take it further because I can learn a lot on my own

>> No.71120525
File: 2.42 MB, 320x240, computer science.gif [View same] [iqdb] [saucenao] [google] [report]
71120525

>>71120493

>> No.71120544

>>71120525
this, just because science is gay doesn't mean computer science is

>> No.71120578

>>71120422
it's pretty good for it's intended purpose: quickly developing 2d gambling games
it's 3d engine is a good 5 years behind UE4

>> No.71120702

>>71120396
No, and now that I'm on the tail end of my bsc, I don't feel very motivated to continue.
I also got a pretty good internship, so if everything works out I'll have a stable position by the end of the summer

>> No.71120791
File: 539 KB, 757x1015, 2e19cafccf97b66df902580dcf65048f55a94063.jpg [View same] [iqdb] [saucenao] [google] [report]
71120791

>>71120396
Nope, I only have kind of LLB (Bachelor of Laws)

>> No.71120850

>>71115804
chans are japanese, you know it?

>> No.71120903

>>71117307
Pretty much. In Objective-C, you send messages to objects. Every "method calls" actually just calls a objc_msgSend C method that basically tries like 6 different ways to find the right function to call and then finally calls it.

Such retarded overhead. One might as well just use Python at that point, if every method call has that much overhead anyway.
The only good thing about Objective-C is that you can write and call C without an expensive FFI and build tool complexity.

>> No.71120920

>>71120140
Yeah, but it'll be slow as molasses even if it happens to work.

You can do this:
if (i == 0 || i == 1 || i == 2)
// ...
if (i == 3 || i == 4 || i == 5)
// ...
if (i == 6 || i == 7)
// ...

However, you may not do this:
if (i == 0 || i == 1 || i == 2 || i == 3)
// ...
if (i == 4 || i == 5 || i == 6 || i == 7)
// ...

Or this:
if (i < 8)
// ...

What you however may do, is this:
if ((bool[7]){true}[i])
// ...

However, no more than 7 this time. Why? Who knows.
Anyway, we can pull this truly baroque move:
if ((bool[7]){true}[i] || i == 7 || i == 8)
// ...

What the fuck, GCC?

(Clang handles this normally, even without the if statements)

>> No.71120981

>>71120920
>Yeah, but it'll be slow as molasses even if it happens to work.
I doubt it. There's no real reason for that to be the case.

>> No.71121034

>>71120981
It'll have to write it out into memory.

>> No.71121040

Objective C++20 is the most powerful language in the world.

>> No.71121053

what is the spookiest thing in open source reepository? like some rando guy just came in, commit something huge only never to be seen ever again

>> No.71121075

>>71121034
For the sake of indexing it like an array, you'll have to wait for it to go to L1 at most. Probably just the store buffer. So no, it will not be slow.

>> No.71121091

>>71121053
its me im the spookiest thing in open source repos, its almost like im not even there

>> No.71121095

>>71121075
It will be in an inner loop.

>> No.71121119

>>71121095
Anon, we are talking about an overhead in cycles that you can count on your fingers.

>> No.71121132

>>71121119
Yes, and if you inner loop is 10 cycles that's a pretty significant slowdown.
No, I'd rather use regular methods.

>> No.71121217

>>71121132
Well, do you know how fast extraction from a register is? If you want to avoid using memory at all, then you can do a loop of extracting the first element and then rotating. I suggest you try both.

>> No.71121264
File: 1.15 MB, 740x1152, 0fba62aa69f4c4e9557a90a226f5af87d5fcf5b4.png [View same] [iqdb] [saucenao] [google] [report]
71121264

>>71121040
I agree!

>> No.71121266

>>71120396
lel, i couldn't even finish high school.

>> No.71121270

>>71121132
>>71121217
Also, if you're looping through vectors then you would need to be loading them from memory anyways, no? You only need to spill to memory once per vector.

>> No.71121344

someone make functional programming general!!!!!

>> No.71121369

>>71121344
To be fair, you have to have a very high IQ to understand Haskell. The language is extremely subtle, and without a solid grasp of theoretical type theory most of the concepts will go over a typical programmer’s head. There’s also Simon's puristic outlook, which is deftly woven into its monadic I/O, which draws heavily from category theory, for instance. The users understand this stuff; they have the intellectual capacity to truly appreciate the depths of these concepts, to realise that they’re not just useful- they say something provable about PROGRAMS. As a consequence people who dislike Haskell truly ARE idiots- of course they wouldn’t appreciate, for instance, the convenience in multi-paramater typeclasses which itself is a fancy way to say "multiple dispatch". I’m smirking right now just imagining one of those addlepated simpletons scratching their heads in confusion as Simon Jones genius wit unfolds itself on their terminal window. What fools.. how I pity them.

And yes, by the way, i DO have a Haskell tattoo. And no, you cannot see it. It’s for the androgenous genderless assholes’ eyes only- and even then they have to demonstrate that they’re within 5 IQ points of my own (preferably lower) beforehand. Nothin personnel kid

>> No.71121380

>>71121344
no

>> No.71121386

>>71121053
https://lkml.org/lkml/2018/9/20/444

when linux updated its code of conduct, a few contributors threatened to remove their code by revoking the gpl license.

>> No.71121463

>>71121386
and?

>> No.71121481

I'm working on NENEQUEST

>> No.71121520

>>71121369
so... yes?

>> No.71121552
File: 48 KB, 500x500, ayaya.jpg [View same] [iqdb] [saucenao] [google] [report]
71121552

>>71121481
nene ne?

>> No.71121592
File: 72 KB, 525x478, 1556451480797.jpg [View same] [iqdb] [saucenao] [google] [report]
71121592

>>71117579
comfy video fampai

>> No.71121626

I'm grinding interview problems because I have an interview coming up. I'm nervous.

>> No.71121627

>>71117579
>Bob Martin
https://youtu.be/IRTfhkiAqPw?t=1177

>> No.71121656

>>71121552
NENECCHI IS LOVE

>> No.71121689

>>71121626
https://www.youtube.com/watch?v=10WnvBk9sZc

>> No.71121704

>>71121626
just be good at bluffing and talking

>> No.71121717

>>71121217
>>71121270
This isn't in an inner loop, I realized, this is just tests.
But no, the vector is obtained from doing calculations.

>> No.71121752

>>71121717
What are you actually using the extracted elements for?

>> No.71121755

is there a better way to check for a win in tic-tac-toe besides hard-coding each row/column/diagonal check?

>> No.71121860

>got interrupted while programming and had to leave my den
>on my way to run the errands I spotted an irl catgirl
what the fuck weebs, you're taking it too far!!!

>> No.71121875

>>71121860
was she a stray? did you adopt her

>> No.71121970

>>71121755
You could use bitmask shenenigans but don't worry about it, it's not like it's a computationally heavy task to run a few loops once every so often.

>>71121875
Yes and I don't think the latter would be legal.

>> No.71122048

>>71118956
There is literally nothing wrong with dynamic typing.

>> No.71122050

>>71121970
>choosing the law over the catgirl

>> No.71122059

>>71121860
If you are in San Jose, FanimeCon is this weekend. To make this post more programming related, I did attend a panel for indie game developers and spoke to a guy about (emulated) ROM hacks for various old console games to make them more interesting, like a Sonic 1 mod that killed you if you touched a ring.

>> No.71122063

>>71122048
theres everything wrong with dynamic typing

>> No.71122072

>>71120525
The whole SICP meme in one picture.
A loud statement for the sake of being "deep".

Boring, uneducated people calling it "computer science", but only True Programmers™ know it's not science (it's MaGiC) and not about computers. Think different, amirite.

>> No.71122085

>>71122050
I mean how the fuck do you even approach that? I wake up, get on the computer and program until I pass out, it's been the first time I left my bedroom in 3 months.

>>71122059
Nah, eastern europoor but that sounds like an interesting activity.

>> No.71122098

>>71122059
>implying indie games are programming related
>>>adgdvg

>> No.71122118

>>71122048
Dynamic typing exists because it is easier to write interpreter / compiler without type system

>> No.71122266

>>71121752
Comparing to a reference non-vectorized function.
Essentially, I have a vector and a scalar implementation of the same code. The scalar implementation is trivial, the vector implementation is a clusterfuck. So the only way I can unit-test it is by checking that the helper functions are correct, then running the big loop blob and comparing it.

>> No.71122308

>>71122266
And you care about a few cycles in a unit test why?

>> No.71122312

>>71121755
if a[0][0] == a[0][1] == a[0][2] ||
a[1][0] == a[1][1] == a[1][2] ||
a[2][0] == a[2][1] == a[2][2])

Is what I'd do.
For connect four, you can use a loop.

>> No.71122349

>>71122308
I don't, I realized it wasn't the inner loop in >>71121717 already.

>> No.71122358

>>71122063
Like?

>> No.71122372

Quick quiz! Given the following:

void f(unsigned int);
void f(int);
void f(char);


Which overload gets called by the following?

char x = 1;
char y = 2;
f(x + y);


Alternatives:

1. f(unsigned int)
2. f(int)
3. f(char)
4. No-one knows the type of char + char

>> No.71122390

Guess this is just an OOP question in general, but I'm using C++.

How exactly do objects of different classes interact with each other in their own code?

say you have an object of class A and an object of class B, both created in main. If object A needs to do something with object B in one of its functions, how exactly should this be done, since both of their scopes are in the main function?

I thought about passing the object as an argument, but there's no way that that's practical if you have a bunch of different objects, and even less so if you have nested functions inside of each other. I'm sure there's a more general way to ask this question, but it's something I've been struggling with over the last few days since trying to transition from C to C++, where the use of global variables in the former seems to be less frowned upon.

>> No.71122397

>>71122372
probably implementation defined, I know char + char gets promoted to int but if char is unsigned (and it may well be) then the promotion may be to unsigned int rather than simply int

but I don't know for sure

>> No.71122429

>>71122372
Which language?

>> No.71122440

>>71122390
Sure it is, just pass a pointer around. If you use it a lot, make one object a member of the other.
In general, the simplest way to write C++ coming from a C background but use methods and access control rather than bare structs.

>> No.71122443

>>71122429
Anon...

>> No.71122444

>>71122429
C++.

>> No.71122461

>>71122429
C--

>> No.71122495

>>71117034
nice one, anon

>> No.71122503

>>71122372
Platform dependent.
Some platforms will promote chars to int for arithmetics, in which case f(int) will be called.
Some won't.

doubt any relevant platform will call f(unsigned)

>> No.71122510

>>71115804
You forgot to list your pronouns and shill for Rust.

>> No.71122523

>>71122510
obsessed

>> No.71122549

>>71122440
Just seems kludgy desu

>> No.71122638

>>71122372
What a pathetic type system.

>> No.71122642
File: 51 KB, 454x453, gee bill poly.jpg [View same] [iqdb] [saucenao] [google] [report]
71122642

>>71122549
>Just seems kludgy desu
Welcome to object oriented design.

>> No.71122651 [DELETED] 

im working on codears katas because its fun and im new enough to learn stuff from them. I hate the ui on the site though so i just write stuff in Pycharm (using python duh) and then paste it in.

problem is, I cant get this to solve on the site although it works for me in PyCharm:

problem: https://www.codewars.com/kata/sort-the-odd

my code:

list = []
odd_index_list = []

odds = sorted([n for n in list if n%2])

def index_grabber(odds):
for n in odds:
list.index(n)
odd_index_list.append(list.index(n))

def odd_attempter(list):
for index, num in zip(sorted(odd_index_list), odds):
list[index] = num

def sort_array(list):
if len(list) == 0:
print(list)
else:
index_grabber(odds)
odd_attempter(list)
print(list)

sort_array(list)


to make it work just put the array you wanna sort into "list" at the top, don't know how to make it work on their site though lol

>> No.71122668

>>71122651
ooops i fucked up the code, how do i fix that on 4chan again?

>> No.71122680

imagine sharing a thread with p*thon babbies

>> No.71122682

>>71122668
put it between [--code][--/code] tags, remove the --

>> No.71122726

>>71122549
What would you be doing in C?
If the answer is "using globals" you're not using C correctly

>> No.71122744

>>71122726
No one knows how to use C correctly anyway.

>> No.71122757

>>71122682
thanks


im working on codears katas because its fun and im new enough to learn stuff from them. I hate the ui on the site though so i just write stuff in Pycharm (using python duh) and then paste it in.

problem is, I cant get this to solve on the site although it works for me in PyCharm:

problem: https://www.codewars.com/kata/sort-the-odd

my code:


list = []
odd_index_list = []

odds = sorted([n for n in list if n%2])

def index_grabber(odds):
for n in odds:
list.index(n)
odd_index_list.append(list.index(n))

def odd_attempter(list):
for index, num in zip(sorted(odd_index_list), odds):
list[index] = num

def sort_array(list):
if len(list) == 0:
print(list)
else:
index_grabber(odds)
odd_attempter(list)
print(list)

sort_array(list)




to make it work just put the array you wanna sort into "list" at the top, don't know how to make it work on their site though lol

>> No.71122802

>>71122757
just fucking put the odd numbers on a list and then quicksort them then put each one between an even number in the even numbers list, jesus

>> No.71122847

NEW THREAD!!

>>71122834
>>71122834

>> No.71122852

>>71122802
why are you so angry lol? im obviously new to this

also i tried that, and this other way worked easier for me. there are obviously other cases with more or less even numbers, 0s etc and that tripped me up

>> No.71122858

>>71122726
Give me an example. Probably, I'd pass in structs of structs/struct pointers instead of multiple structs.

>> No.71122880

>>71122802
dude chill

>> No.71123035

>>71122390
If you don’t mind A and B being coupled and A needs B for purposes strictly internal to A, passing pointers or references is just fine.
If B has no real purpose except to support tasks inside of A, consider making B internal to A.
If it is something done using A and B, and the results are not strictly internal to one or the other, a free function that takes a pointer/reference to A and B might be better.

>> No.71123062

>>71122549
>>71122642
>having first-class objects
>probably the most elegant thing you could have a programming language
>not related to OOP in any way
>reeeeee opsie is badsie
Maybe you just bad at programming?

>> No.71123262

>>71117998
Rust really is a parody of a project.

>> No.71123312

>>71116746
yes

>> No.71123482

>>71117336
>le secretely gay homophobe xDxD
Cringe.

Nobody cares that people have gay sex in private, but gays definitively tend to be obnoxious people based on every single one I have interacted with irl. Most people that hate gays, hate them because a lot of them behave in such a way that their sexual preference defines their entire character. They act in such a cunty flamboyant catty way that if they were women I would hate their guts too. Also, there's the whole "literally pulling your dick out in front of children in big degenerate public parades" thing.

>> No.71123857

>>71115971
I came to this

>> No.71123876

Who else gets turned on by code?

>> No.71124198

>>71123876
Not the code itself but when I see programs utilize the full power of a machine with utmost efficiency. Seeing something use 100% CPU for less than a second before completing a large task near instantly. It makes me feel good and hold a sense of appreciation for the author(s).

>> No.71124247

What's the best youtube for learning C# at intermediate to advanced? The spaghetti in my big projects should be a hate crime.

>> No.71124308

>>71123876
that divine 640 by 480 feel when you learn something new and you go through a project you're passionate about and make it faster and easier to read

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action