[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

[Advertise on 4chan]


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1610458728481.png (2.91 MB, 1881x2656)
2.91 MB
2.91 MB PNG
Old thread: >>79663647

What are you working on, /g/?
>>
fuck rust.
>>
>>79673811
committing acts against humanity
>>
fuck vulkan
>>
Indoctrinate me into the cult of smalltalk
>>
File: sicp (2).jpg (167 KB, 480x640)
167 KB
167 KB JPG
>>79673811
Join the SICP study group: >>>/g/cspg
>>
id fuck a rust
>>
>>79673835
It seems that the brainlet filter worked.
>>
>>79673838
stop spamming your shit thread
>>
>>79673854
> He doesn't read SICP
>>
>>79673838
Your general is getting filtered because it has a discord link.
>>
>>79673866
>he reads books instead of programming
>>
File: 1583724399227.png (263 KB, 471x385)
263 KB
263 KB PNG
I really wish there was a DBus library for C that wasn't garbage or had some glaring issue to it.
- libdbus: Extremely painful to use API
- gdbus: Glib cancer
- sd-bus: Very nice and simple API, but tied to libsystemd which is a dependency you can't pull in for no reason
Everything else is abandonware or random hobby project tier.
>>
File: 1599030070409.png (346 KB, 439x500)
346 KB
346 KB PNG
>>79673811
> What are you working on
Finding the strength to kill myself.
>>
>>79673992
stop using Aloonix distro.
>>
>https://en.wikipedia.org/wiki/Printf_format_string#Type_field
Why It's this fucking crap differet for every programming language? It's fucking confusing.
>>
>>79674059
You shouldn't be using printf, you should be using fmt.
>>
>>79674068
You shouldn't be using fmt
>>
>>79674059
Regardless of how retarded formatting is in other languages, sepples has the stupidest way of formatting shit.
printf("%x%d%.3f\n", x, y, z);

noooooooo illegible, weird, unsafe.
std::cout << std::hex << x << std::dec << y << std::setprecision(3) << z << std::endl;

ah yes beauty.
>>
>>79674233
This is partially fixed in C++20, and will be fully fixed in C++23.
>>
>>79674233
You forgot to save and restore the stream state afterwards.
>>
>>79673811
Porting some C++ code to Object Pascal.
>>
>>79673811
>>79670508
In Haskell this is just
import Data.List ((\\))

main :: IO ()
main = (print . maximum . combinations) 3144

combinations :: Int -> [Int]
combinations n = (g . f . sequenceA . replicate (length ns)) ns
where ns = listifyInt n
f = filter (([]==) . (\\ ns))
g = map intifyList

listifyInt :: Int -> [Int]
listifyInt n = (\x -> read [x] :: Int) <$> show n

intifyList :: [Int] -> Int
intifyList xs = read (show =<< xs) :: Int
>>
File: 1592763745867.jpg (161 KB, 1440x1690)
161 KB
161 KB JPG
>>79674267
Best girl should have won
>>
>>79673828
fpbp
>>
>>79674307
At least she got an "if" light novel arc and a spinoff manga. The other best girl never stood a chance.
>>
you niggers will argue over anything

return isA ||
isB;


or

return isA
|| isB;

>>
>>79673838
structure and interpret deez nuts
>>
>>79674400
indentation got all fucked but you get the idea, don't let too much sand get in your vaginas
>>
>>79673837
>POO
>dynamically-typed
>>
>>79674400
In Haskell this is just
f True = ...
f False = ...
>>
>>79674400
return isA || isB;
>>
#include<stdio.h>
int main(){
puts("Hello world!");
return0;
}

Im trying to compile this on windows with drag and drope (Im using tcc). Why does not work? I tried to drag and drop the examples with no issue, an exe file came out, but with my own file doesn't work(I wrote It in notepad and saved It with .c extension).
>>
>>79674483
Can't you use MSVC?
>>
>>79674419
Smalltalk OOP is not POO
don't blindly throw POO out if you don't understand what it actually means/implies
>>
>>79674483
>winshit
>noteshit
stopped reading right there
>>
File: images (4).jpg (8 KB, 222x227)
8 KB
8 KB JPG
holy SHIT I am having a brainlet rage
cannot solve one problem for 3 days, skip it and decide solve other and then stuck AGAIN FUCK
>>
File: unnamed.jpg (113 KB, 900x900)
113 KB
113 KB JPG
How do I get programming gf?
>>
>>79674502
Post, we'll give hints
>>
>>79674483
what are you even saying? does tcc even have a PE32 output or a linker for windows?
>>
>>79674440
assume isA and isB won't fit on the same line so yuo either leave the || at the end of the first line or at the beginning of the new line
>>
I'LL HAVE A PROGRAMMING CONTEST SOON (20 MINS)
I THOUGHT I COULD USE ANY LANGUAGE BUT NO, I MUST USE C) FUCK FUCK FUCK

CAN YOU HELP ME WRITING A TEMPLATE? SHARE YOURS
I AM NOT READY
>>
>>79674545
let isA = gibberish ... ;
let isB = gibberish ... ;
return isA || isB;


if your compiler doesn't have SSA to eliminate isA/B assignment, I don't know what to tell you.

if you want multi-line return I'd do.

return isA
? isA
: isB;
>>
>>79674518
I posted it here one or two threads before, then changed it a little bit
>Find next greater number with same set of digits
static int? NextBiggerThan(int number)
{
if (number < 0)
{
throw new ArgumentException("Number cannot be less than 0.");
}

string str = number.ToString();
int[] num = new int[str.Length];
int temp;
int minDigit = 0;
int i;
int minNum = 0;
int index;
for (i = 0; i < str.Length; i++)
{
num[i] = str[i] - '0';
}

for (i = num.Length - 1; i > 0; i--)
{
if (num[i] > num[i - 1])
{
minNum = i - 1;
break;
}
}

for (int j = i + 1; j < num.Length; j++)
{
if (num[j] > minNum && num[j] < num[i])
{
i = j;
}
}
temp = num[minNum];
num[minNum] = num[i];
num[i] = temp;

//Array.Sort(num, index + 1, num.Length - 1);
//Console.WriteLine(num[i]);
for (i = 0; i < num.Length; i++)
{
Console.WriteLine(num[i]);
}
return i;

}

NextBiggerThan(534976);

This looks horrendous but I don't really care now, literally want to kys myself
I managed to swap 4 and 6 and I need to sort it now
>>
>>79674525
Yes It does:
http://download.savannah.gnu.org/releases/tinycc
>>79674487
Use what?

Its fixed, there was no space between 0 and return. Anyway, now I wonder something. What's the difference between doing:
#include<stdio.h>
int main(){
puts("Hello World!");
return 0;
}


And:
#include<stdio.h>
int main(){
puts("Hello World!");
return 0;
}

Which one It's better to use?
>>
>>79674669
just because there are windows builds doesn't mean anything. I have no clue what you're asking or what your problem even is, do you know anything about C, programming in general or what?
>>
>>79674514
have you tried going outside
i think i'll be going outside this afternoon
wish me luck

>>79674586
what is this even supposed to do?
also do yourself a favor and compute the integer decimal length yourself with repeated division by 10
>>
File: 1608124078484.jpg (59 KB, 960x893)
59 KB
59 KB JPG
>>79674561
stfu
>>
Sup /dpt/

I'm trying to teach myself Python & R for data analysis for part of my degree.

I've just signed up the the website datacamp, but I'm also trying to get a more general feel for the languages as well.

I'm finding it hard to find any courses which pitch the content at a decent beginner level. I've done a couple of courses on linkedin learning the first one seem overly patronising and whilst not really explaining anything.

I've noticed a lot of the courses don't really teach you anything they just get you to follow along without giving you the background details of what you're doing.

Is there anywhere I should be looking for good courses ?
>>
File: 1539115016622.jpg (34 KB, 619x453)
34 KB
34 KB JPG
>>79674708
>>
>>79674561
Post questions here, so we can do them for fun and not post the answers.
>>
>>79674669
>what's the difference between indentation and no indentation
non-indented code is undefined behavior in C, DO NOT EVER DO IT!!!
>>
>>79674724
mm okay if I'll be in difficulty I'll post them
even if.. i would feel bad.. it's kinda like cheating

I;m also a fucking dumbass: every other team have 3 members and I'm alone lol
>>
>>79674729
kek
>>
>>79674278
>[]==
null
btw several of your type sigs make the sigs for read not necessary. haskell is pretty good at pushing the type information around
>>
>>79674669
I did more reading on tcc

https://bellard.org/tcc/tcc-win32.txt

their own doc page links to a 404 for win32 support and I have a feeling it depends on mingw for crt. just use gcc from a mingw install.
>>
>>79674704
>have you tried going outside
programmers don't go outside dumbo
>>
>>79674704
>also do yourself a favor and compute the integer decimal length yourself with repeated division by 10

why?
>>
Any ideas for Quantum Mechanics programming projects?
>>
File: file.png (532 KB, 999x823)
532 KB
532 KB PNG
hello sirs
>>
>>79674968
compute the masses of some hardrons with a lattice QCD simulation

https://arxiv.org/abs/1808.08490
>>
>>79675264
Thanks although I was thinking of something more related to classic QM
Maybe Stern Gerlach experiment or something that implements the postulates
>>
>>79674748
I quit lol
because my timings are shit I won't submit anything. fuck.
On the university website it was written that specific programming skills were not required
I wasn't prepared to to this in C. Half of the time goes on fucking parsing the fucking inputs. fuck.
next year I'll smash those pussies
>>
https://youmightnotneedelectron.com/
>>
>>79675455
git gud
>>
>>79675455
get rekt scrub
>>
>>79675490
>>79675495
I know I'm so shit
>>
Making an operating system with web frontend in Common Lisp using object-oriented programming.
>>
>>79675508
Use electron for GUI
>>
>>79674755
i go outside sometimes... i-i'm going outside today, at the library

>>79674800
because that's simpler and more efficient than converting it to a string if all you want to do is to have an array of single digits

auto splice(unsigned int n){
std::vector<unsigned char> r;
unsigned int n2 = n;
while (n2 != 0){
n2 /= 10;
r.push_back( n - n2 * 10 );
n = n2;
}
std::reverse(r.begin(), r.end());

return r;
}
>>
>>79675455
>>79675503
to be fair C is a pretty dumb choice for a programming contest
more like handling-Dennis-Ritchie-bad-design contest
they could at least have used C++
>>
Can someone post that project rolling image?
>>
>>79675564
yeah they allow also C++, Perl and Python.
I felt more confident going with C because I have been preparing for a C uni exam I have tomorrow.
My choices, my faults.
>>
>>79675525
I've had gathering at library around 4am when we were drinking which of course was outside of the library but I assume you are going into library which does not count as going out.
>>
>>79675589
https://dpt-roll.github.io/
>>
>>79675626
eh.. lets roll
>>
>SICP is so basic and boring book
Learn SML
>>
>>79675637
wtf is a static website generator?
>>
>>79675665
>A static site generator (SSG) is a compromise between using a hand-coded static site and a full CMS. You generate an HTML-only website using raw data (such as Markdown files) and templates. The resulting build is transferred to your live server.
>>
>>79675665
it doesn't move
>>
>>79675665
build a website that code itself like this

https://www.strml.net/
>>
>>79675686
>>A static site generator (SSG) is a compromise between using a hand-coded static site and a full CMS. You generate an HTML-only website using raw data (such as Markdown files) and templates. The resulting build is transferred to your live server.
got it, thank you!

>>79675702
kek

>>79675730
>javascript required
disgusting
>>
>>79675455
Java, Python, C++, and Rust are better choices for comp programming but you should go in with a template of algorithms and data structures. C is one of the worst choices.
>>
FUCK SHIT NIGGERS BITCH ASS NIGGERS FUCK SHIT SHIT NIGGER BITCH DICK FUCK I CANNOOOOOOOOOOT SOLVE THIS AAAAAAAAAAARRRRRRRRRRRGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>>
sine wave generator from psuedorandom numbers....hmmmmm
>>
File: omegaslurp.gif (3.16 MB, 710x755)
3.16 MB
3.16 MB GIF
>>79673811
Worm things, very 'buggy'. (are worms bugs? I know they're not arthropoda, but I think some people would consider them bugs).
>>
>>79675843
wtf is that game?
where can i try it
>>
File: speedruncompressed.gif (3.15 MB, 316x174)
3.15 MB
3.15 MB GIF
>>79675933
http://ditzbitz.com/pomao.html
also I have a repo if you wanted to run it locally
https://github.com/Packmanager9/Pomao

I highly recommend using a controller if you have one, the keyboard controls have a learning curve.
>>
https://www.youtube.com/watch?v=aHk42kDwesM
>>
>>79676079
why is SICP so cringy
>>
File: 1571833315699.png (414 KB, 557x521)
414 KB
414 KB PNG
Any other WFH Anons play video games when there is nothing else outstanding to do at work? Help me feel less guilty about it
>>
6 branches in my repo were deleted a few hours ago, 5 of them were merged so its ok but 1 was still wip (it was merged one time but later reopened, guess thats why he decided to delete it as well). I hope pushing from local copy of branch will preserve the commit history (there is a need for them to be) but like can you at least warn if you are doing a thing like that, what the actual fuck
>>
[AttributeUsage(.Method)]
struct LogAttribute : Attribute, IComptimeMethodApply
{
public static String gLog = new .() ~ delete _;

[Comptime]
public void ApplyToMethod(ComptimeMethodInfo method)
{
String emit = scope $"LogAttribute.gLog.AppendF($\"Called {method}";
for (var fieldIdx < method.ParamCount)
emit.AppendF($" {{ {method.GetParamName(fieldIdx)} }}");
emit.Append("\");");
Compiler.EmitMethodEntry(method, emit);
}
}


[Log]
public static void MethodA(int a, int b)
{
//inject logging at compile time
}
>>
>>79676565
what do those tags in [] do?
>>
>>79676708
they're attributes, metadata for reflection, in this case compile time reflection
>>
>>79676254
>someone else deleted branches in my repo
What the fuck are you doing wrong?
>>
>>79652094
>>
>>79677107
How are you not already using ncurses? Absolutely yes, use it.
>>
>>79677107
>will i have to use ncurses or something
if you want to stay sane, yes
>>
File: Wizards only, fool.jpg (6 KB, 263x192)
6 KB
6 KB JPG
>>79676104
Fuck you, that shit is tight yo. But no really, I like it. I think it's cool
>>
>>79677338
how does telnet do it then?
>>
>>79677364
Programmers having romantic ideas that they're some kind of wizard is stupid, I suppose it's typical that it's coming from Lisptards
>>
>>79677367
Its old, before nurses was a thing, so its probably using escape codes directly. Escape codes are dependant on the terminal used, and nurses handles that in a platform independent way. Stop trying to not use ncurses and just use it.
>>
>>79677409
I just like that processes can be used as data and recursions doesn't necessarily use a stack and can just tail-recurse. It definitely feels like wizardry, and while silly, I still like the image. But yeah, it's nerdy as fuck
>>
>>79676988
It's a team-based uni assignment that we do on uni's git server. That's why I hoped that commit history would stay when I'd push from local, they are going to grade based on how much work each member of the team did (or rather, decrease the grade if someone obviously did much less work than the others). Thankfully the commit history got restored.
>>
>c89 doesnt have snprintf
this shit causes me more suffering than you could possibly imagine
>>
>>79677868
In Haskell this is just
putStrLn
>>
>>79677868
>c89
But it's 2021
>>
>>79677944
i want my hobby programs to run on obsolete platforms for fun
>>
kinda getting stuck on writing my compiler
finding a good design for how shit is getting parsed is hard

>>79677868
sneedprintf
>>
>>79677868
there are some snprintf implementations online if shipping it will solve your problem.
>>
>>79676565
what lang?
>>
>>79677868
It's just a normal function, doesn't need any special c99+ compiler features, you can write it yourself.
>>
https://blog.golang.org/generics-proposal

https://blog.golang.org/generics-proposal

https://blog.golang.org/generics-proposal
>>
Hot
>>
>>79678107
writing a standard-conforming snprintf implementation isnt something i want to do, mainly because of the trillion modifiers that exist on format specifiers
>>
>>79678141
>In the wake of the racially motivated murder of George Floyd, we have decided to affirm our commitment to social justice by implementing generics in the Go programming language
why do they have to make everything political?
>>
>>79678141
is it still a proposal?
when is it going to actually be implemented? jesus christ
>>
>tfw you dont have an efren to code malware with
sucks
>>
>>79678174

Big tech wants Race mixing and Social Justice. It has nothing to do with the products. They just are pushing this tranny and blacked bullshit everywhere.

Everything has to be political and introduce more division into the populace. The reset & new world has to be set up somehow
>>
>>79678059
beeflang :)
>>
>>79678268
post your threat vector
>>
>>79678298
but i dont do anything illegal!
>>
Automatic garbage collection and languages without pointers. Good or bad?
>>
>>79678174
topkek
>>
>>79678439
optional/mix-match GC > No GC > Forced GC
>>
>>79678457
>optional/mix-match GC
Example languages that do that?
>>
>>79678487
D/Nim
D is a bit more restrictive/coupled with it depending on which std libs you're using. But you shouldn't run into too much trouble.
>>
>>79678147
Well support the big ones only. Ints, floats, strings, and pointers.
>>
>>79678517
Do you consider languages without pointers better than languages with pointers?
>>
>>79678487
D does it, poorly at that. optional GC isn't a good design choice for a language, if you want GC, implement it for a specific domain. D's entire standard library is built with GC in mind leaving you kinda gimped if you opt out of using it.
>>
>>79678487
>Herb Sutter: "I've haven't written delete in years."
>>
>>79678532
Depends what kind of things you're doing.
Not everyone is doing kernel/low level projects. But generally, I think programming langs should have pointer access in some way that's not messy C interop hacks.
>>79678541
>D's entire standard library is built with GC in mind leaving you kinda gimped if you opt out of using it.
that's not exactly right.
>>
>>79678457
So wrong...
>>79678541
This is correct.

Design your language to have implicit GC, or not. Opt in/out of an implicit GC is messy as fuck. Its a tool of languages who are trying to "do it all", but no one has ever even got close. Design your language around a certain use case and don't fuck around.
>>
>>79678728
When I make my own language it won't have garbage collection, but it'll be simple for the programmer to optimize it themselves.
>>
>>79678728
>So wrong...
Not everything in your program needs explicit MMM. It's the same as haskell zealots thinking everything needs to be lazy by default.
Just because D fucked up, doesn't mean the concept is not sound for future langs.
>>
>>79678585
>that's not exactly right
oh i'm sorry, 99%*
>>
https://notabug.org/koz.ross/awesome-c
>>
>>79678783
>oh i'm sorry, 99%*
/dpt/ really has a bad habit of talking about langs they've clearly never used in any depth.
>>
for(i = 1; i <= n; i++) {
for(j = 1; j <= m; j++)
cout << a[i][j] << " ";
cout << "\n";
}


is the same as
for(i = 1; i <= n; i++)
for(j = 1; j <= m; j++)
cout << a[i][j] << " \n"[j == m];
>>
>>79678815
over the years i've developed x-ray vision of harsh critique, i need but 1 nanosecond glance over a language spec to deem it either as useful or useless.
>>
>>79678762
Its not, just not at all. If you want to have the ability to run without GC in the runtime, design you language with that assumption. Then ship a GC implementation as a library the user can use explicitly. The issue is the implicitness, not the GC.
>>
How many of you made your own programming language? How long did it take?
>>
>>79673811
Lisp is the most powerful programming language.
>>
>>79678878
I don't need to when Lisp exists.
>>
>bro read SICP
>scheme lmao
It doesnt even have a dictionary data structure. No, I'm not going to implement it myself with recursion when I can just use pythons { }
>>
i couldn't handle the office life
>>
>>79678849
Yeah i'm sure running the hello world example really qualifies a langs entire extent.
Nevermind that you don't even have factual critiques of the lang.
Here's 1 i'll give you for the future:
Walter is meandering on @nogc conversion, and they've been wasting their time on shitty bikeshedding sugar like this gem.
https://forum.dlang.org/post/enmjtcvxpurvgcsnmzfd@forum.dlang.org
Which is going to confuse people when they also learn D's array syntax for length.
arr[$- 1] // arr.length - 1
>>
Lisp is only good as a DSL
>>
>>79678916
In Lisp, this is just
(make-hash-table)
>>
>>79678957
yes I also tend to use CL (SBCL) over scheme. Scheme is a meme.
>>
>>79678878
not really a programming language but a DSL using purely operator overloads for syntax
var result = ((3 * 3) & "hello world");
>>
>>79678919
How long did you last
>>
>>79678978
like 2 years
>>
Retarded question
classname A; // default constructor used here
classname A(); //default constructor not used here

if i write A(a,b,c), a constructor will take all these variables to initialize the class member variables, then A() shouldn't just call the default constructor?
the compiler is talking that declaration as a function.
>>
>>79678972
I'd prefer a Lispy config language over mostly anything else however, so Guile gets a pass from me.
>>
>>79678929
just like Lua's #t, nothing wrong with that
>>
https://www.agner.org/optimize/optimizing_cpp.pdf
>>
>>79678916
scheme has association lists, which are a natural evolution from basic cons lists, and true hash tables via srfi 69

but no one's telling you to read sicp because of scheme, or to actually use scheme in big real world projects
>>
What are books on good general programming practices to make cleaner and less bug prone code?
>>
>>79679004
It's just a waste of time, and D's not really in the spot to have the luxury of implementing sugar operators like that when there's so much else to get done first.
oh well
>>
Co routines in C

https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
>>
>>79678982
I hear that. I want to do the same, but I also want to move into a bigger place. Eh at least I'm debt free for now...
>>
>>79679030
It's very simple, and you don't even need a book. Learn Haskell.
>>
>>79679055
Yeah I paid off my debts too. Now I have no idea what will happen. I haven't paid rent in months and nobody seems to care.
>>
>>79679091
Who knows. Nothing wrong with taking a break if you have a chunk of change saved up though.
>>
>>79678929
what about the half assed borrow checker lol
>>
Does not having pointers make a language a bad language?
>>
>400 lines to wait for keyboard input.

https://geoff.greer.fm/vim/#realwaitforchar
>>
https://pastebin.com/wrWj9YQT
How did I do?
>>
>>79679212
pretty readable
>>
File: jbd6q1xfgya61.png (505 KB, 640x862)
505 KB
505 KB PNG
>>
>>79679530
One thing I hate about C is how easily you can shoot yourself in the foot with pointers and references.
>>
>>79679212
[return: MarshalAs(UnmanagedType.Bool)]

this isn't needed, you never need to explicitly marshal primitives
>>
>>79679530
template <class T>
static constexpr auto (T&& a, T&& b) -> decltype(a + b){
return a + b;
}

git gud
>>
>>79679592
>both T
>doesn't work if + returns a reference
>>
>>79679578
I copied pasted that one :)
>>
File: 1610564743400.jpg (1.64 MB, 1433x2024)
1.64 MB
1.64 MB JPG
>>79679044
i use async macro for all of my single threaded gui programs written in c that handle async network requests and no one can stop me
>>
>>79674059
Rust doesn't have this problem.
>>
>>79673811
a social network based on IPFS, thank me later.
>>
>>79673811
reading about CLIPS
>>
>>79679592
goddamn, this is the 5th day learning c++ and today I'm on static class members but seeing shit like this makes me feel bad.
i don't understand most of that fucking code.

template <class T> .. what is that
a function with an arrow and decltype?
the return type being constexpr?
those parameters (T&& a,. T&&b) what the fuck is going on?
>>
>>79679952
You don't need to know any of that anyway
>>
>>79679952
it's a generic type parameter, but just like everything else in C++, it had to be made as complicated and convoluted as humanly possible
>>
>>79679530
fn add<T: Add<U>, U>(x : T, y: U) -> T::Output {
x + y
}
>>
>>79680038
can T not be Add<U> And Add<U2>? how does output disambiguate? what if something else had ::Output regardless?
>>
>>79680074
fn add<T: Add<U, Output = V>, U, V>(x: T, y: U) -> V {
x + y
}

fn add<T: Add<U>, U>(x: T, y: U) -> <T as Add<U>>::Output {
x + y
}
>>
Retard here, I'm stuck because I know what i want to do has a name but because I don't know the name of the thing I want to do I'm having a real hard time searching for it.
I want to layout a number of images inside a fixed size canvas, but I want to maximize the space used by finding the optimal locations for each image.

It's an optimization problem but does it have a specific name that I can use to search for it?
>>
File: 1581357788090.jpg (100 KB, 1080x1207)
100 KB
100 KB JPG
>Rust
>>
>>79680038
[ConstEval] public static T Add<T>(T a, T b) where T : operator T + T =>
{
return a + b;
}
>>
>>79680111
Bin packing
>>
>>79680134
Thanks that's it.
>>
>>79680105
oof
>>
>>79680222
I would prefer functional dependencies rather than associated types, myself.
>>
anyone with knowledge of opengl ES 300, my texture just renders at all black. im just curious if my shader is wrong, it works at the vertex color renderer just not texture
the vertex renderer
#shader vertex
#version 300 es
layout(location = 0) in vec4 position;
layout(location = 1) in vec3 Normal;

uniform mat4 tran;
out vec3 F_Normal;
out vec2 texCoord0;
out float far;
void main(){
gl_Position = tran* position;
F_Normal = Normal;
far = gl_Position.z;
texCoord0 = vec2(position.x,position.y);
};

and the fragment rendere
#shader fragment
#version 300 es

precision highp float;

in vec3 F_Normal;
in float far;

in vec2 texCoord0;
uniform sampler2D textureSampler;

out vec4 FragColor;

void main()
{
float outie = (F_Normal.y+0.25f)+(F_Normal.x+0.5f)-F_Normal.z*0.5f;
vec4 FOG = vec4(far,far,far,1.0f)/10.0f;
vec4 lightTotal = vec4(outie,outie,outie,1.0f);

FragColor = lightTotal + texture2D(textureSampler, texCoord0).rgba;
}
>>
>>79680280
https://stackoverflow.com/questions/8886286/opengl-es-2-0-texture-renders-black-several-hours-without-resolution
>>
>>79680343
>several-hours-without-resolution
many such cases!
>>
>>79678174
>>79678141
Go confirmed to be rebranding to Goerge Floyd, will now allow syntax highlighting as symbolic solidarity with coders of color.
>>
File: SWEEP.png (4 KB, 640x400)
4 KB
4 KB PNG
>>79673811
>>
extern crate rand;

use std::io;
use std::cmp::Ordering;
use std::ops::{Add, Sub, Mul};
use rand::Rng;

fn sub<T: Sub<Output = T>>(A: T, B: T) -> T {
A - B
}

fn add<T: Add<Output = T>>(A: T, B: T) -> T {
A + B
}


fn main() {
let number = rand::thread_rng().gen_range(1, 101);

println!("Guess the number!");
println!("Please input your guess.");

let mut guess = String::new();
io::stdin().read_line(&mut guess).expect(
"Failed to read line",
);

println!("You guessed {}", guess);

let guessed_num: i32 = guess.trim().parse().expect("Wanted a number");

match guessed_num.cmp(&number) {
Ordering::Less => println!("Too small!"),
Ordering::Greater => println!("Too Big"),
Ordering::Equal => println!("Got it!"),
}

println!("Answer was: {}", number);
println!("Answer plus guess is {}", add(guessed_num, number));
println!("Answer minu guess is {}", sub(number, guessed_num));
}


This is a simple introductory program why is it so ugly?
>>
Is haskell a good programming language to learn after learning Python and a little bit of Lisp?
>>
>>79680572
no, probably not
>>79680552
because it's overengineered to showcase more language features
>>
>>79680572
>Is haskell a good programming language to learn
no. next
>>
>>79680636
>overengineered
>two functions and a few calls
>>
File: 1628998742960.jpg (15 KB, 692x607)
15 KB
15 KB JPG
>explicit return only
>mandatory parenthesis, optional curly brackets
>opt-out mutability
>if-else not an expression
>fallthrough as default behavior
>no higher order functions
>uncurried functions
>null
why did this shit ever catch on?
>>
>>79680572
Do real projects
>>
>>79680526
After further talks, I pre-defined all variables as sane types.
DIM e AS INTEGER, freq AS INTEGER, fres AS STRING
FOR e = 365 TO 1035 STEP 5
freq = FIX(EXP(e / 100))
>>
File: stux.jpg (79 KB, 500x335)
79 KB
79 KB JPG
it's high time you started contributing to floss.
>>
Null considered beneficial - /g/dpt/l
>>
>>79668950
holy based
>>
>>79680636

How exactly is it over-engineered? The generic Add and Sub functions are the only thing that really isn't necessary. The rest is basic input validation and program logic.
>>
>>79680572
>Is haskell a good programming language to learn
It's a very good language to learn, especially if you've mostly been doing imperative style programming. That being said, it is very different from C-style languages so don't go in expecting things to work the way you're used to, because they likely don't.
>>
>>79680125
more like a small workaholic Asian guy in plain clothes raised by perfectionist parents
>>
>>79674244
>std::format
it's very unlikely that libfmt will be included as a built in library, it's probably gonna be a 2nd class C++ library just like std::filesystem because C++ doesn't wanna add any bloat to the linking time (to cull unused functions).
libfmt is made to replace iostreams as a compile time alternative, since iostream will still be used because it is an abstract interface, you can use templates but templates suck.
and printf has already supported compile time warnings about mismatching types, and C++ naturally supports C strings.
printf isn't great, but it is perfectly fine for printing logs into a file, and if you keep your code clear of any C++ bloat you can get 10x improvement in compile time.
>>
Learning memesnek, just started fiddling with threads
How far am I and what lang(s) to learn for making a CRUD app?
>>
>>79680343
thanks, wasnt it, but i think im one step closer now
>>
>>79680222
is oof the ending indicator of foo statement?
>>
Stop programming.
>>
>>79680987
no thats bar
>>
>>79680873
neither is pattern matching for cmp really. overengineered might not be the right word, but it is supposed to show stuff off and not be actually like anything you would normally write
>>
>>79681015
ok
>>
>>79681015
I never start
>>
>>79681015
ok, im getting tired
>>
>>79674233
but sepples one is unironically more legible
>>
>>79680969
threads in snek are kind of broken (look up GIL)
>CRUD app
probably JS if you want the UI to be inside a browser
>>
>>79681103
There are places for DSLs and the standard library is not one of them.
>>
>>79680782
one word: boomers
>>
Programming is not useful irl outside of applied programming. The pure programming bubble is for professors only.
>>
>>79681122
And if not? I'm happy if I can make a phone app that can communicate with a server if my own. I've been told there's no point in learning a GUI framework since a browser works well enough but I don't know how it is for phones. I've also been told JS is trash. What are most apps out there coded in and with what frameworks
>>
>>79674233
the second one looks unironically way cooler.
esp. when you have short lines
looks like moon module computer commands
>>
>>79681257
what is pure programming vs applied programming?
>>
>>79681305
One is about creating problems, the other is about solving them
>>
Is Monogame a good framework for building a nice UI with animations for a C# application?
>>
File: Grug Crood.png (145 KB, 422x322)
145 KB
145 KB PNG
>CRUD app
>>
what is jupyter notebook and why is it so popular

i've been programming for 20 years and i don't get why you need code laid out like an interactive document
>>
File: 1583517904165.png (166 KB, 1158x1064)
166 KB
166 KB PNG
>>79681450
honestly what the fuck
why do this instead of just running the program?
>>
>>79681450
it's not for programming, sweatie. It's for data science
>>
>>79681367
Game engines have become massively more useful than frameworks. If you're not set on using a framework or C#, you can use C++ in Godot. Which is great because it's all free and open source, so you have even more control and ownership over what you make with it.
>>
>>79681518
that makes it even weirder. data science = statistics and numerical analysis. why do you need an interactive 'notebook' hun?
>>
are bank jobs comfy and boring
im lazy and dont wanna do much
>>
>>79681450
>why is it so popular
Because some people like working that way, with a mix of input, output and descriptive text. I don't care for it myself.
>>
>>79681367
Don't you think a full game engine is a bit much for fancy button animations? Maybe look into something like Uno, Xamarin, Avalonia, or even just GTK#
>>
>>79681596
but what kind of 'work' is this for? do people use the bits between the code to write notes?

why not just use comments?
>>
Javascript > React / vue
PHP > Laravel
Python > Django
C++ > ?????
>>
>>79681519
I agree, I've actually played with Godot and love it. The reason I asked is I'm only using Monogame for making a prettier UI for a simple program I've already made, because it's much better at handling graphics than the default libraries, and my program deals with panning and zooming images and stuff and I want it to feel modern and smooth. I've used Monogame for this purpose before and I'm comfortable with it, I just wonder if it's overkill for something like this
>>
>>79681568
if by comfy you mean shittons of red tape and software so ancient that their original authors are likely dead by now, then yes
>>
>>79681626
>?????
C++ 20
>>
>>79681568

There are bank jobs that literally still maintain COBOL code. If you consider legacy cruft and high-risk applications where one mistake is more costly than just shooting the jew that hired you sure.
>>
File: DJT2jjdW0AIIPCk.jpg (51 KB, 600x380)
51 KB
51 KB JPG
>>79673837
The syntax of the entire language can fit on a postcard (or pamphlet), so it's really easy to spread the good word.
>>
>>79681544
Has a nice repl, works in cloud, more portable than an IDE, embeds plots and formatted text nicely.
Personally I prefer R with RStudio but jupyter is pretty good for python.
>>
>>79681639
Maybe try something like Xamarin like >>79681619
mentioned.
That seems like something a bit more suited for what you're looking to do. Otherwise, Monogame seems fine.
>>
>>79681654
yeah, that's pretty based i would say
>>
>>79681621
>why not just use comments?
Because some people's brains don't work that way.

And occasionally it's easier to explain something with hypertext or a picture than just plain monospace text. Only rarely, but even so.

I've also seen notebooks with complex results embedded. Those are pretty neat, but not revolutionary, and they tend to be a lot more difficult to share with others.

My overall take is that they're OK, but intended for people other than me.
>>
>>79681367
i prefer SFML personally, but I've used Monogame in the past and it works. As far as using it just for the sake of UI, I'd probably look into something like Dear ImGui instead together with GLFW.
>>
I'm three runtime errors away from switching to python
i fell for the C++ meme
>>
>>79681619
>>79681706
>>79681783
yeah my goal is designing everything from scratch and drawing graphics quickly, and monogame lets me do this but it does indeed seem like overkill, which is precisely why I was asking. So if I can accomplish that with these libraries then you've shown me what I was looking for. Thanks anons!
>>
>>79681865
3 runtime errors vs 800ms execution time difference, i'd fix the errors but you do you
>>
>>79681865
C++ is unironically a beautiful, intuitive language. I have never come across something with it where I say to myself
>well that doesn't make any sense why would they do it like that?
javascript on the other hand is just pain of arbitrary, nonsensical bullshit.
>>
>>79681865
Use Rust and turn those runtime errors to compiletime errors
>>
File: wantdie.png (316 KB, 1024x962)
316 KB
316 KB PNG
>>79680834
but i dont know how. what could i possibly contribute when im not very good at programming and i dont really have any specialty or field of interest?
>>
>>79681865
You're retarded. You're going to get more runtime errors in python. Switch to Rust and you won't have a lot of problems.
>>
>>79681950
Do things like fixing documentation and providing localizations.
>>
>>79681939
unsafe { * } 
>>
>>79681988
unsafe { sex }
>>
>>79673811
A flask backend, it's aids.
>>
Now that Swift is on Windows, do you guys think it'll become more adopted outside of development for Apple devices?
>>
>>79682237
no, everybody will just keep using c# with windows.
>>
>>79682237
now that you might not be called an iToddler for using it
>>
>>79680572
Haskell is based
>>
>>79682260
But Swift seems like it'll soon be better than C# for multiplatform programs. I get C# being the go-to when writing a program for just Windows.
>>
long long johnsson;
>>
>>79682237
What do you mean "now"? It's been on Windows for a bit now but they'll never treat it as a first class target and you can't do anything useful with it. They won't port SwiftGUI to it. Apple has no idea what they're doing other than make their platform more locked down and devs more locked in to dumb proprietary shit.
>>
>>79682632
https://swift.org/blog/swift-on-windows/
>now
>September
close enough, nigga, I can't keep track of this past year
It's open source, so why would Apple be needed now that it's native on all platforms?
>>
>>79682237
>uses lldb
lol they didn't even port it, if it was ported then they would be using the native debugging format windows offers.
You may hate it, but it has the same problem that rust has, which is that you cannot benefit from windows JIT debugging, which is basically the "not responding" window offering a debugger to attach to. If your code crashes without a debugger already attached, all debug information is lost unless you hook a built in stack tracer (which cannot capture errors like double free because heap corruption).
Of course the reason why codeview isn't supported is because of the dependency on visual studios to generate that info, but without codeview you cannot use tools like crashrtp, for sending crash reports.
>>
>>79677944
>Muh current year
Stellar reasoning, friend.
>>
>>79681950
there are different areas where non-programmers are of help, like the other anon said
>>
>>79682717
it's maintained by like 1 dude and it's not even close to first class or tier support. they don't care about it at all and neither do windows devs. google tried to push swift for tensorflow and that never took off. it's dead in the water.
>>
using github is cringe
>>
>79682941
>I HAVE A BIAS PLS NOTICE ME
>>
>>79682965
but you have a bi-ass lmao
>>
The last thing we need is another autist spamming the same shit over and over every thread.
>>
>79682980
I'm not the one that desparately seeks male attention by making overly simplistic hot takes.
>>
>>79683032
>male attention
show 1 (one) man here
L M A O
>>
>>79683040
>Dick or gtfo
KEK ok here's your (you), gayass.
>>
>>79683071
having a dick doesn't necessarily make you a man. Keep on dreaming.
>>
Okay I read your reply again and I have already told you that in the lpBaseAddress I copy exactly the address that "Cheat Engine - The Dubious Source" as you call it, which is very offensive and abusive alias for me, displays in the window by adding the "0x" code characters to tell the compiler that this value is address and the function continues to fail.

Does it mean that the address given by the dubious source in quake is valid? It should be valid, because in cheat engine, I can set the value pointed by this address and it's working (through the cheat engine window, not by WriteProcessMemory called in my Win32 API). If it was invalid, then I couldn't set the value of this flag, but I told you already that I could, so it must be valid! I tell you that Cheat Engine is incredible! Why do you think that it is dubious source? I know that it is dangerous, because it writes to process memory directly and so it may crash, and I know that playing with cheat engine is like "playing with fire", but it can harm my computer only if I use it wrong. I use Cheat Engine for a very long time and my computer wasn't damaged by that, because I always used it properly. I really know exactly what I am doing! I am absolutely not newbie with this stuff! I really know exactly how does the computer works and how do applications and malwares work as well and what viruses do and how they damage your computer in general. I also have installed softwares that protect my computer from these threats, like Comodo, Firewall, Antivirus, Sandbox and etc. I also backup my computer, so in the worst case it is "gone", I can restore it very quickly with no problem! Don't worry! I am very aware of all this! I really know exactly what I am using and what the risk I am taking! I don't worry. And if I was newbie, then I wasn't asking this question from the beginning. I don't even think that I was deal with MSDN or know something about it.
>>
>>79680552
>no standard random number generator in stdlib
>>
https://250bpm.com/blog:4/
>I'm unwilling to close my try block and catch exceptions immediately afterwards throwing them therefore C++ inadequate
What THE FUCK did this lad mean by this?
>>
File: index.png (3 KB, 344x146)
3 KB
3 KB PNG
let me guess, you need more?
>>
>>79683320
who needs error checking anyways lol like seriously just write good code
>>
>>79683297
General purpose RNGs are bloat or not what you actually want most of the time.
>>
>>79683320

Everything that could throw would require a try-catch block. If the standard mechanism for errors is throwing in your codebase that means pretty much every fucking call or error type is going to have its own try-catch block.
>>
File: 1591906964510.jpg (84 KB, 812x720)
84 KB
84 KB JPG
Which workstation on Visual Studio should I install if I want to check the source code of files written on JS?
>>
>79683099
I didn't say "man", I said male. That, however is beside the point.
"Man" merely qualifies an adult male.
Sure, not all here are adult males.
But, by definition and the fact of the board, most people on here are men even if they delude themselves otherwise.
Whamen just don't do as much tech shit.
>>
>>79680930

fmt and by extension std::format take a similar approach to printf where functions such as printf forward to vprintf. std::format is a simple wrapper that packs the variadic template args in a type erased container (no allocations) and forwards them to a function that takes that pack i.e std::vformat which is not a template. This allows fmt/std::foramt to achieve a binary footprint similar to stdio.h functions while still supporting formatting user defined types and being type-safe like iostreams while being faster than and having a similar binary footprint to functions in stdio.h.

Here's an article that towards the end shows how you would wrap writing to the syslog via systemd using fmt/std::format.
>>
Why is my WPM/RPM failing, I open a handle to the process with
PROCESS_VM_OPERATION | PROCESS_VM_READ
access rights, but it keeps throwing error 5 (no_access), or error_partial_copy.

I decided to try changing virtual space protection with VirtualProtectEx, it also fails.

I am out of ideas, I can't figure out at all why Read/WriteProcessMemory will not work and yes the process snapshot and handle is all 100% good.
Here is one line of my RPM function
ReadProcessMemory(pHandle, (LPVOID)m_iHealth, &m_iHealth, sizeof(dwLocalPlayer), nullptr)


Anyone have any clue?
>>
>>79683614

forgot link:
https://www.fluentcpp.com/2018/12/04/an-extraterrestrial-guide-to-c-formatting/
>>
File: 1457656003439.png (341 KB, 749x650)
341 KB
341 KB PNG
can someone give me an example of a typical fiverr job? i've been playing with C#, Python, PHP and MySQL for quite a few years now and I'm pretty confident at this point and I want to monetize my skills. but I keep chickening out because I feel like I'm going to get a task that I'm not prepared for and I won't be able to do it and I'll get a bad reputation. I've only done personal projects so I don't have much of a resume.
>>
File: congratruation.png (4 KB, 254x192)
4 KB
4 KB PNG
>
#pragma once


>
#ifndef FAGGOT_H
#def FAGGOT_H
...
#endif


Which one do you use and -- more importantly -- why?
>>
x.cpp
#include<iostream>
#include"x.h"

int main() {
int cmd, a, b; //cmd for choosing 4 options 1 addition 2 subtraction 3 multiplication 4 division and two variables to ues to do the calculations

std::cin >> cmd; //user chooses what type of arithmetic operation he wants to perform

switch(cmd) //switch testing user input
{
case 1:
input(a, b); //function from x.h takes two intergers and asks user to assign values with std::cin
std::cout << a + b << std::endl; //prints results of calculation to console
break;
case 2:
input(a, b);
std::cout << a - b << std::endl;
break;
case 3:
input(a, b);
std::cout << a * b << std::endl;
break;
case 4:
input(a, b);
std::cout << a / b << std::endl;
break;
default: //incase the user types a number bigger than 4
std::cout << "something went wrong\n";
break;
}
return 0;
}
//problems:
//it gives weird results if you take substraction and type "50 - 25" it outputs -1773511261
//and also for some reason the std::endl at the end of the cout’s doesnt do anything

x.h
#pragma once

int input(int x, int y) {
std::cin >> y;
std::cin >> x;
}
>>
>>79683297
Why should there be?
>>
how do i put some effort into working
im a neet and i do nothing productive
>>
>>79683325
i need opamps
>>
>>79683799
Pragma once.
>I have never met a compiler that didn't support it
>It avoids collisions
>Can trivially be converted to guards with a script if you want that for some reason
>>
>>79683799
The vast majority of languages don't have this problem.
>>
>>79673955
why you need DBus? Use unix domain sockets.
>>
>>79683942
reward urself by sucking ur own dick
>>
>>79683711
a simple web app
>>
>>79683942
get a goal. work towards it
>>
>>79683581
the js one???
>>
new

>>79684116
>>79684116
>>79684116
>>
>>79684127
please wait until 310, then your post in the old thread should be at 311. the sheer insanity of making a new thread only to bump the previous thread ahead of it.
>>
>>79684149
at least 311 i mean
>>
>>79683614
std::vformat is used for redirecting output, so like being able to take an input and split it into 2 streams, but the problem is that it only works with a temporary fixed sized buffer or dynamically sized string.
The problem is that if you want to make a JSON parser to use std::format as the way of accessing a file, is that an abstract std::format object would have no choice but to be a function pointer (std::function probably), when it's much more desirable to have an object like a stream (std::ostream / std::istream).
std::format isn't designed to be used as a stream, but that itself is the problem, it cannot replace std::iostream, so instead it will just be an optional extension for C++, and I bet the next edition of stroustroup won't bother covering it because it isn't really a library that fits in very nicely, and it seems redundant to teach 2 ways of doing formatting.
I wouldn't be surprised if msvc chooses to not support fmt and just disregards it's existence and nothing more than just a 3rd party library.
>>
>>796840099
as if this implies anything at all



Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.