[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 / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: C.png (107 KB, 701x832)
107 KB
107 KB PNG
What are you working on, /g/?

previous >>101153696
>>
>>101194447
context first then the rest of the arguments
choose wether you want to put input/source argument first then the output/destination arguments or vice versa, then stick with it
eventual "parameters"/options at the end
>>
Setting up a hoard of pdfs
>>
I suggest we rename the thread to weekly programming thread since the thread no longer reaches the bump limit within a day anymore (it's over)
>>
crossposting

>>101193283
>compiles to what you want in real programs
nothing personal, kid

also if you do objdump you will see that when giving you registers the compiler wont bother integrating them into the code, instead it will back them all up and say "play with the xbox"
so the builtin is just faster.

>>101194848
faggot, rename it /prog/ if anything

>>101194753
>c++
>passing arguments through the fathering structure
>elegant
/c/huds stay seething
>>
>>101194870
>>c+
no
>>passing arguments through the fathering structure
>arguments
it's not really arguments and often it's for mutating that context struct. elegant or not you don't have a choice. it's either that or using a global variable
>>
>>101194922
no, they are arguments, i guess you cant into multiple layers of abstraction.
>>
>>101194848
post faster
>>
>>101194934
>no, they are arguments,
no because functions will use all the fields.
>i guess you cant into multiple layers of abstraction.
yes? no? I feel this is going to be a shit discussion. You don't seem to get what I mean by context and I can't be bothered to develop.
>>
>>101194989
context in my language means changing the thread getting cycles, i am not going to discuss a fucking language of all things, in the first place but even moreso with a faggot who uses words that hold no meaning and then gets pissy about people ignoring them for the schizo rambling they are
>>
Would this game help me get an understanding of assembly? https://store.steampowered.com/app/370360/TIS100/
>>
File: 1715017521375986.jpg (3.34 MB, 3500x2500)
3.34 MB
3.34 MB JPG
I have been experimenting with WinUI 3 and not gonna lie i like it, but it needs more updates, i'll create some personal projects with it, wpf is dead for me
>>
>>101195080
>swaps context without changing threads
heh, nothing personal
>>
>>101195080
>context in my language
you understood the first time, stop being a faggot
>insufferable nonce ramblings
ok, cio
>>
*ciao
>>
>>101195203
no i didnt
>ciao
jump off a bridge
>>
>>101195218
have a (You)
>>
>>101195238
(You) too kind sir have the bestest reddit hugs award
>>
>>101195134
shenzhen i/o and exapunks are better
>>
>>101195270
are you trying to make me stay and (You) you forever or are you trying to make me go away?
>muh redditor
dude, you can't stay on the subject for more than 1 post. yeah I'm going to end up fucking off there. better NPCs and bots than a schizo/faggot like you

I'm trying to watch a TV show so STFU
>>
(You) come across a C program
in the first few lines you encounter this in the defines
#define YES 1
#define NO 0

does this raise an eyebrow as something only a noob or incompetent programmer would do, or is this just normal?
>>
that thread is fucking dead and worseless anyway
>>
>>101195347
kys
>>101195343
kys
>>101195350
kys
>>
>>101195364
keep yourself safe!
>>
>>101195364
>does not wish to discuss with anon
>does not wish anon to go away either
you are the fucking lowest nigger race on the internet

fuck you and fuck this fucking general, everyone already left anyway
>>
>>101194591
What does his tshirt say?
>>
File: file.png (96 KB, 901x691)
96 KB
96 KB PNG
hello, I have a question regarding unix sockets.

In order to check if there are queue requests you call poll on the server file descriptor. So accept-ing the request gives me a connection file descriptor which I can talk to. Should I keep that connection filde at all times to keep connect-ed clients?
should I close connect-ed fds if I get POLLNVAL or POLLERR? pic related
>>
>>101194848
It would go faster if you could report posts for discussing easy mode """languages""" that only exist to waste CPU cycles.
>>
>>101195347
it's perfectly fine since every C type used in a boolean expression will resolve to false if set to 0. I wish more languages would do this as it's very useful and conducive to writing terse code
>>
File: glitch.webm (643 KB, 1280x720)
643 KB
643 KB WEBM
Can someone tell me what I'm doing wrong here? For some reason, the player moves really slowly left and right, gets stuck on walls, and at the end, I can't jump or move horizontally at all.
Code: https://pastebin.com/DznS0znj
>>
>>101196724
It's not possible to tell exactly what's wrong with the code you pasted, but common mistakes:
when you touch a wall, for a brief period in between frames your floor detection method is inside the wall and flags off your "in air" boolean so you're no longer falling and appear to be sticking.
I would look up a basic character controller tutorial on youtube, judging from your code you're making it a bit more complicated than it needs to be. I also can't tell if you're factoring in delta time with your movement at all.
>>
I am trying to create images, that feed from an xml file, and then write text from said xml file.

I am thinking of writing it in a script language, so that I can pass that script, and send it to other peers to use.

I had been considering Jimp and Js, however I am open to suggestions.

The idea is that it is a simple script that doesn't take long to setup. However ideally should not take long to code either.
>>
I was working with the magickwand API but there's no way to wrap text around an image. My entire project is ruined.
>>
>>101195576
virgin
>>
>>101195576
bobs & vagin
>>
File: blockspy.jpg (30 KB, 512x585)
30 KB
30 KB JPG
We all agree that it's better to separate blocky code with newlines right. Fors, if else, functions, all blocky code nicety separated. I want lints to auto format in this convention
>>
>>101197813
I agree at least
>>
>>101197813
they both suck
a newline after 17 is enough
>>
>>101197813
I'm not going to scroll back and forth through your several screens-long mega-functions all the time. Get terse or get indented on arrival.
The real solution, by the way, is keeping code in reps in whitespace-invariant form. Your wild formatting fantasies are cute but they shall not concern anybody outside of your machine.
>>
>>101195733
there simply was nothing to read, just poll again. Stop speaking in such abstract terms btw
>>
File: 4chan hiccup.jpg (796 KB, 995x2041)
796 KB
796 KB JPG
>>101197813
That makes a lot of sense in Python, much less in languages that don't rely on whitespace as much as Pyhon does. If I were to leave empty lines around every if- of when-statement in picrelated, the function definitions would look disjointed and ugly.
>>
Any way to make a tkinter combobox show the options while you type? I gave it autocomplete but it's less useful when you have to click the arrow to see the filtered list.
>>
>>101195347
You don't understand c. The point of c is that any the project lead can morph the language into one suitable for the project. This can be as little as typo and function prevention, clarity in common cases, to changing the language to match the problem domain (look at the implementation of j, it seems silly, but array languages are dense, you need to constantly be thinking in those terms or your skills will atrophy, turning c into an array language is a way to accomplish this)
If you are working with low level code it's common to have unsafe funtions macro'd to gibberish, as for your example, there are certainly contexts that exist where this is appropriate, what it actually does is discourage unnecessary math expressions and hint that it's a conditional. Like INVALID, UNREACHABLE, START STOP, IN OUT or ON and OFF for a state machine.
Weather or not any of this is usefull is context dependent and based on the experience of the lead programmer. Newbies often take style guides and apply them where they don't fit. Applying the linux (extended) style guide to game programming or webdev wouldn't be useful, wouldn't make sense and would actively be harmful since there are many "patterns" whose correctness are context dependent.
>>
>>101195134
https://store.steampowered.com/app/684270
>>
already lads so I’m going to make an interpreter+C transpiler for some basic lang.
Is scala.js good for this? So I can run the interpreter on the browser. I already know scala so it seems like a nice choice. Where as other js things don’t have pattern matching
Question is, am I gonna get fucked in the future by something scalajs can’t do?

also don’t mention performance nobody cares in this context
>>
>>101199980
>already
alright****
>>
>>101197813
no, vertical readability is a must for me.
>>
File: posix.png (132 KB, 1898x295)
132 KB
132 KB PNG
Does anyone have experience with ancillary data with unix sockets when it's being used in stream mode?
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
So say a sender using sendmsg twice with 4 bytes each, both with SCM_RIGHTS or whatever, and then I recvmsg with 8 bytes, it'll stop and only read 4 bytes?
>>
>>101198790
you dont get many (You)s but know I am watching you and I like your project
>>
>>101200067
this is why you should be doing read or simply mmap the description
>>
>>101200110
I normally use SOCK_DGRAM for this kind of shit, where the message boundaries and behaviour are obvious, but unfortunately I have to use SOCK_STREAM for the protocol I'm trying to speak.
>>
>>101200068
Thank you anon. If I finish it like I envision it might actually be portable enough for me to publish it on github or something.
>>
File: 1711662007398.png (12 KB, 298x355)
12 KB
12 KB PNG
>>101200067
>posix
What is the use case?
>>
>>101200479
>Haskell.png
>>
>>101195347
Smells like the author likes to do unnecessary ad-hoc bullshit for things that already exist, like <stdbool.h>.
>inb4 ansi
Then he should have made them an enum with the standard names
>>
When did you realize that languages like apl, j and lisp were memelangs? I baby ducked on haskell(cause i already knew algebra and category theory from math and thought it would be that path of least resistance, but quit after reinventing the complex number library), and later j and bqn, but failed to implement a prime number sieve in bqn after days of trying (the authors solution uses 20+ language constructs/functions), then later while reading a book on c when I got to the chapter on arrays I implemented a sieve in 5 minutes using it's hard to remember now but maybe 7 languages constructs (arrays, assignment, modulo, addition, while etc)
That's why I'm excited for vaporware like jai that gives a c-like language the nice compile time and metaprogtramming features of lisp.
>>
>>101200598
>quit after reinventing the complex number library
why
>>
>>101200663
Whatever book I was reading said to. After checking my answer in prelude I realized that nobody their knew anything about programming (cause they were the same)
>>
>>101200479
I don't know if this post is just you being a wintoddler or some shit, but I thought I've give a go at writing a C dbus client library that doesn't have a dog shit API (libdbus) or have some massive dependency attached to it (gdbus, sd-bus).
>>
>>101200598
>C
>long compile time
on what planet do you live?
>>
>>101200709
there*
>>101200711
>>long compile time
Who are you quoting? But also yes, c by design has poor compile times.
>>
omg hi realtime anons!

>>101200710
>dbus client library
you are likely the only person on g who can respond so: can you explain the point of dbus?
>>
>>101200735
>c by design has poor compile times
You can compile the Linux kernel and however millions of lines that is in the order of minutes.
C is not C++.
>>
>>101200755
>millions of lines
>minutes
>on a processor that does ~10 billion operations per second
Yes, slow by design. And again, you misread the first post.
>>
>>101200771
>1 operation meaning moving one character to the right
>waiting for 40 operations for the character to be read into a register and operated on
wow so fast!
>>
>>101200740
>can you explain the point of dbus?
Just a system for doing IPC, instead of everyone having to roll their own for everything.
DBus is definitely far from perfect, and people (especially Gnome; fuck Gnome) misuse the hell out of it, but it has plenty of inoffensive use cases.

It's really shit at handling large amounts of binary data, because it's a text protocol and everything will need serialisation, but being able to pass file descriptors over the protocol using SCM_RIGHTS solves a lot of that. That doesn't work over TCP, but then, why the fuck would you use DBus over TPC? The spec does support that, though, but I believe some implementations like dbus-broker skip that part.
>>
>>101200800
>what is throughput
>millions of lines
>~100 bytes/cycle * 5 Ghz
>~500 GB /s
Keep going. I'm interested in how you think computers work.
>>
>>101200828
>Keep going. I'm interested in how you think computers work.
s/computers/compilers/g
>>
>>101200849
>cargo cult /g at the end
Kill yourself. You do NOT get to act like you ME. I said what I said.
>>
>>101200828
you are massively retarded, you cant do text comparison operations on the vector registers no matter how hard you try to get fancy, so you need to move things into the general purpose registers, you may be able to pull a lot from memory at the same time but that is it, and it still takes some 300 cycles each time because caches got so huge they got slower and remember that every time you do this nonsense you are pushing symbol tables (which are fucking huge by the way) out of cache and will have to go get them again and again and again
There is no such thing as throughput here, the fact you got so smug just shows how stupid you are.
Not to even mention that nonse of the compilers are good enough to operate this way.
>>
>>101200875
who is ME?
>>
>>101200875
>I said what I said.
To show you know shit about how compilers work.
>>
>C compiles slowly
stop wasting air on your shill garbage and kys
>>
File: 1660693672769779.jpg (10 KB, 217x320)
10 KB
10 KB JPG
>>101200975
>350 loc/sec
>>
>>101200906
You don't know shit. You can simply look up 20bytes/cycle for l3 that's 100G/s
>it takes 300 cycles each time
Each time what nigger? Each time you get a cache miss? NIGGER YOU HAVE 64 MEGABYTES of cache HOW ARE YOU MISSING 2 MEGS ON EACH THREAD 2 MILLION BYTES
31250 quadwords
3906 512bit numbers
>>
>>101200975
>I have no reference for how fast software should actually run besides comparisons to other software
You could have just said you don't know anything about computers and have left it at that.
>>
>>101200709
what?
>>
File: 1705096042335585.png (681 KB, 787x830)
681 KB
681 KB PNG
>>101194447
destination, size, elements, source
>>
>>101201172
>memcpy
?
>>
>>101194447
What difference does it make in a language without currying? Just don't make too many arguments like microsoft does and you're golden.
>>
>>101201074
Woah there, anon! You wouldn't go and repeat shit said by other people like a brainded monkey, would you?
>>
>>101201339
>What difference does it make in a language without currying?
The convention simply reflects the hardware at the time, e.g. loading an address into a register before adding/subtracting any offsets
>>
>>101201438
>I ran a compiler, and this is how fast it was. I guess that's just how fast it is
>who the hell is this retard trying to calculate how fast the program should run, doesn't he know how complicated computers are, let me set him straight
>runs compiler, takes screenshot
>SEEEEE!
How does the point go THAT far over your head?
>>
>>101195136
U using ceples or c-shart?
>>
i wish there was a clean way to round up
>>
>>101201676
ceil(x) is too much for you?
>>
>>101201590
>I ran a compiler, and this is how fast it was. I guess that's just how fast it is
That's how it works dumbfuck. Do you think the people who dedicate their lives to eeking out ever last performance improvement have an unoptimal compiler, sure it might be within .9x of optimal on any given machine, but that's a tradeoff made for portability. There are no 10x easy gains left. Stop shitting out every lie cmuratori and jblow spew to their child audience. It's the techbro equivalent of Tate, absolute nonsense.
>>
>>101199387
>linux (extended) style guide
I know about the Linux kernel style guide, but couldn't find anything about the "extended" version. What do you mean?
>>
>>101201741
I meant stuff that isn't in the actual style guide like what kind of functions (io, performance characteristics, flexibility etc) are used which are avoided, or even when to use functions at all as opposed to inlining. Proper inlining is one of the first things you learn in large projects with multiple people as it's very easy for someone to misuse functions that you make, so someone with experience knows not to write functions that are prone to misuse in certain contexts.
>>
>>101201705
not a python shitter, you faggots are math majors and use libraries that abstract even that out kek, do you even have fun doing this shit i wonder...
>>
>>101201718
if you make a good compiler once you can make it compile high level code for all architectures

also you can just make good transpiler

skill issue
>>
>>101201925
ceil(x) is part of math.h
>>
>>101201590
Why don't you show me how fast it should be then?
And not rustroon shit of
>OMG 5% faster (10% of the features)
>>
>>101201978
yeah and? you are not rounding it up yourself are you?
math majors literally cant into
//1 indexing for optimization
if (var%granularity){ var = (var/granularity+1)*granularity}
else{ var += granularity;}
>>
>>101202001
>I wish there was a clean way of doing something
>provided with a clean way to do it
>NO, look at this messy way I did it manually aren't I cool?
Not really it just comes across as shallow and tells people you aren't interested in getting real work done.
>>
File: goalposts.jpg (204 KB, 845x1200)
204 KB
204 KB JPG
>>101202023
>>
>>101202023
you take "clean way to do it" as meaning less text, i take it as a matter of universe and reality itself. We are not the same.
>>
>>101202147
"Rounding" is a convention and not a matter of universe and reality. You are the same because you both think you have a better understanding than you do.
>>
>>101201981
>show me how fast it should be
Show me your cpu and algorithm.
Jai's stated goal is 1M loc without deltas, on a normal dev machine
A few years ago they claim 250K LOC/s. At release it will probably be ~1M LOC for most users, which is probably within 50% of what a $300 cpu can do, (baring smc).
>>
>>101202246
indeed, since it's a convention, ceil isn't always the right thing, for example when you want to get real math done and not just fizzbuzz which doesn't have negative numbers, moron
>>
>>101202272
There is no real math
>>
>>101202290
-7^x = 7
x?
>>
>>101201676
Yeah, You could adjust this thing from stackoverflow that deals with signed ints.
int divRoundClosest(const int n, const int d)
{
return ((n < 0) == (d < 0)) ? ((n + d/2)/d) : ((n - d/2)/d);
}


I usually do (n+d-1)/d*d

>>101201705
Anon didn't specify but that will eventually have precision problems with larger integers if you aren't careful.
>>
>>101202269
>claims, states, claims, ummm probably
So you don't have anything?
Jai's claims are irrelevant until it is finished and Jon's PCs are the furthest things from "normal" dev machines

Pic from me was using an HDD btw
>>
>>101202394
false identity or however it was called
>>
>>101202394
(ln 7 / (i*pi + ln 7))
>>101202523
You are retarded, leave /g/
>>
>>101203254
>claiming that x is a whole fucking function when it clearly came after "-7^"
pretentious nigger
>>
>>101203401
What? You've never seen 2^lg(3) before? It sure is summer; that's like, what, the first year of highschool?
>>
>>101200598
You baby ducked on C.
>>
>>101204132
>no you're holding it wrong
Memelang.
I compared a functional language to c and realized it uses twice as many language primitives as c. So I switched to c. Not to accomplish some low level systems task, but to simply quickly generate some prime numbers. The task itself isn't important, it's the fact that for a large code base that 2-3x will always be there. I shouldn't have to hold a very large language design in my head just to make the correct programming decisions unless there is some real benefit, hence why Jai will be the best programming language mark my words, by 2040 most programs you use will be written in jai.
>>
>>101204381
>2040
damn jonathan blows needs 16 more years to release?
>>
>>101196724
update: got it working, although the code is pretty ugly. I have to loop through the colliders twice; not really sure if that's how I'm supposed to do it.
https://pastebin.com/HdHY2Zk6
>>
>>101194421
It actually says
>今日もSICPを読みましたかい?
>>
>>101202412
>precision problems
Use a double, problem solved. Need to go bigger than that? No, you don't.
>>
File: output.png (870 KB, 1024x768)
870 KB
870 KB PNG
"a beautiful user experience"
>>
File: concurrency.jpg (210 KB, 1261x816)
210 KB
210 KB JPG
want to implement correct version "parallelism" in PHP. doing reader-writer through shared memory sync variants..
>>
>I'll never have something viral like one million checkboxe
>>
>>101200755
Why do some languages compile in seconds like go and C/C++ takes a fucking age? Are the compilers utter horse shit or something?
>>
>>101198321

way too imperative. there were days of {{mustache}} template engines, some still exists but generally replaced by React and Company.

the idea is to have a very high degree of separation of data and template

still ive made a functional style mustache in PHP where one can do functions like

```
{{video id,loop,someOption}}

```

html is not the only destination for those, for example, other destinations could be ESC sequence enabled terminal and some messenger app so i keep faith in it

also the recent rise of React alternative based on sockets.. hmm.. called.. probably LiveView thing. adds application possibility
>>
>>101200755
>in minutes
yeah if you have 128 core workstation with 256 GB of RAM, otherwise full kernel build takes 5+ hours on my laptop and kernel tailored to my laptop still takes well over 50 min.
>>
>>101206325
Did you use only a single make job or some shit (i.e. single threaded)?
>128 core workstation with 256 GB of RAM,
My computer is not THAT high end.
>>
>>101206156
Often times it's #includes since they tend to all get included, and many are templated, just so the various cpp files can see the function definitions etc. they need. So it's compiling the same header files over and over. A language like java has that functionality built in.
>>
>>101206156
>C/C++
Don't group these together, you cretin. They are different languages.
C++ templates absolutely destroy compile times, while C is a fairly straightforward language with nothing surprising that is going to take particularly long, with the main thing being how advanced optimisers are.
>>
>>101206426
delusional
>>
File: o.jpg (468 KB, 666x761)
468 KB
468 KB JPG
!
>>
lleksaH
>>
>>101205884
font rendering still not fixed...
>>
>>101206453
>I lost the argument: the post
Good one.
>>
>>101206621
I'm not him, just letting you know that you're delusional.
>>
>>101206616
>>101205884
Is there some kind of subpixel rendering enabled when rendering the glyphs?
Turn that off.
>>
>>101206621
not either of them, just letting you know you are hallucinating.
>>
>>101206637
So not only did you admit to losing, you also admit that you don't know anything to begin with.
Ok, but I already knew that.
>>
File: tomato_satania.jpg (212 KB, 512x512)
212 KB
212 KB JPG
*bends back to a dangerous degree*
HYAHYAHYA
>>
>>101206670
>mimimi i am a smug faggot coping
ok, there is no need for you to keep humiliating yourself.
>>
>>101205165
Sloppy shit, I would not want to work with you.
>>
use std::env;
fn main() -> Result<(), std::num::ParseIntError> {
// Boilerplate
let args: Vec<String> = env::args().collect();
if args.len() != 2 {
println!("Usage: parity <number>");
std::process::exit(1);
}
let number = &args[1];
let number: u64 = number.trim().parse()?;

// Coding genius comes here
if number == 0 {
println!("Even.");
()
}
if number == 1 {
println!("Odd.");
()
}
if number == 2 {
println!("Even.");
()
}
if number == 3 {
println!("Odd.");
()
}
if number == 4 {
println!("Even.");
()
}

Ok(())
}


It continues to the 64 bit integer limit
>>
>>101198790
You'll need to put in replacement class bindings, and maybe do your own popup (override redirected toplevel containing a listbox) so that you can show just the filtered values. Or maybe you can just configure the one that already exists (how else do you think it works?); that should do the trick provided you can avoid any focus shifts.
God speed.
>>
File: clojure_prime-sieve.jpg (125 KB, 821x359)
125 KB
125 KB JPG
>>101200598
>languages like apl, j and lisp
wtf does Lisp have to do with array languages?

>modulo
Doesn't using modulo kind of defeat the purpose of using Eratosthenes' algorithm?

Picrelated is surely slower than what I could come up with in C or assembly, but it wasn't harder to write by any means.
>>
>>101207409
I've just decided to switch to QT instead. Still learning it because it's a bit more complicated than tkinter, but it has a combobox item that's close enough to what I want (and just looks better without tinkering). Thanks for the effort though.
>>
>>101207435
You're reading comprehension is trash bro
>in bqn
Which has immutable arrays
Besides lisp in this context means a purely functional lisp, not python with parens
>>
>>101194591
shitposting on #git telling why it sucks
>>
>>101206975
utterly unreadable, happy to come from C, my brain was not rot.
>>
>>101207435
>that abomination
>wasnt harder to write than C by any means
what the fuck
>>
>>101207435
Modulo was just an example of what I consider a primitive, not something I used in the program
Primes  { # from rosetta code
x≤2 ? 0 ; # No primes below 2
p S√nx # Initial primes by recursion
b 2≤n # Initial sieve: no 0 or 1
E {∘((x×x+⊢)=)n} # Multiples of x under n, starting at x×x
/ b E⊸{0¨(w⊸⊏)x}´ p # Cross them out
}

below is from ~2 years ago 2021-12-29 20:53:04.007008875 5 minutes after I learned about arrays in c
main ()
{
int a [ 10000 ];
for ( int i = 0; i < 10000; i++ ) {
a [ i ] = 1;
}
for ( int i = 2; i <= 100; i++ ) {
if ( a [ i ] ) {
for ( int j = i * i ; j <= 10000 ; j = j + i ) {
a [ j ] = 0;
}
}
}

int i = 2;
while ( i < 10000 ) {
if ( a [ i ]) {
printf ( "%d\n", i * a [ i ] );
}
i++;
}
}

If the goal of a programming language is to implement a correct algorithm then c clears
In your example you use
~19 language primitives in 7 lines
this c code uses ~13 (including types) at most and they are generally much simpler than a bqn (>30) or lisp primitive, you don't get much more complicated than printf and for. You don't want to see what a library version of bqn's or lisps soe looks like.
No doubt someone better at c could improve this code too.
>>
File: impossible-autism.jpg (57 KB, 567x561)
57 KB
57 KB JPG
>>101207715
>>
>>101207967
stupid frogposter.
>>
File: whisky-kek.jpg (15 KB, 413x395)
15 KB
15 KB JPG
>>101208011
>frogposter
well done
>>
File: primes.png (60 KB, 1351x449)
60 KB
60 KB PNG
>>101207528
>omg where are the semicolons and commas haaaalp

>>101207505
I quoted you directly. When you write
>languages like apl, j and lisp
you're obviously implying that lisp is somehow very similar to the other two
>purely functional
here you go, just for you. Wasn't any harder to write, it's just slow as shit due to using persistent data structures instead of a simple array.

>>101207715
Having proper data structures and standard functions like filter etc. built into the language is a plus, not a negative.
>primitives
Any kind of primitive in Lisp is going to be easier to learn to use than in most other languages due to the simpler and more consistent syntax.
I've forgotten almost all the Haskell syntax I ever knew, but how would I forget Lisp syntax when there basically is none?
>>
>>101207494
>I've just decided to switch to QT instead.
I've used both.
>Still learning it because it's a bit more complicated than tkinter
It's not that much different, at least once you move beyond thinking about surface details. Complex GUIs will probably take quite a bit of work simply to sort out all the fiddly details, whatever you use.
>>
>>101208069
Which do you prefer overall, tkinter or qt?
>>
>>101207715
>you don't get much more complicated than printf
I've read the source to printf() and no, most code doesn't get more complicated than it. There are some horrible edge cases that take a stupid amount of effort to solve correctly.
>>
>>101208085
I'm a maintainer of one of them so I'm a bit too biased to answer that fairly. lol
>>
>>101208048
>Having proper data structures and standard functions like filter etc. built into the language is a plus, not a negative.
Not when they are used as a crutch, c's primitives spans the space of possible programs much more efficiently, or at least the ones that we have algorithms for. Even when it seems like an apl solution is cleaner, it's usually a brittle trick for a wierd non-implementation, like the classic game of life implementation that crosses edges, even then it still uses more primitives than c implementation.
You may be right for assembly though.
>purely functional
And see how it increases the primitive count? Do you really not see that you are making the computer do useless work? Both the programmer and the computer have to keep track of useless work being done just so you can have "correct" code that interacts with each other. This is the main problem with functional programming, it's not just 30 functions it's 30 input specs, 30 output specs, 30 performance specs. If you don't keep track of this stuff it's "Cowboy coding" as it were.
>>
>>101208106
fun fact it was the last unix c library functions ported to c (mid 1978 after the c programming language book was published ) and the reason vargs.h exists.
>>
>>101208106
What a shit but at the same time unaddressable take. Most big-software code gets more complicated that than when you are writing big software.
It is literally just integer to ascii but with funny if else tree and it is not even real code since the compiler mods it to be whatever is best for the given situation
>>
>>101208167
>Do you really not see that you are making the computer do useless work?
Of course I do, but in 90% cases I don't care.
Readability and maintainability are much more important for my software.

You said it yourself, I could just as well write what amounts to Python with parens without even switching to a different language (and in the case of Clojure I could just write functions in Java, JavaScript or Dart and call it almost seamlessly)

A very general construct like a for-loop can be anything. I actually have to read it to find out what it does.
More specialized functions like filter, remove, reduce, map, keep, those tell me much more about what is going on.

But all that is just looking at the level of a few lines of code. What's actually relevant is managing complexity as my programs grow, and functional programming helps with that enormously by reducing the amount of state I have to keep track of.
>>
>>101208493
>the amount of state i have to keep track of
explain.

>gayvo
>>
>>101208167
>This is the main problem with functional programming, it's not just 30 functions it's 30 input specs, 30 output specs, 30 performance specs.
That is the strength of functional programming. You can measure what you want and replace the implementation of what you want and the process remains the same.
>>
>>101208493
Why ignore the sentence after that? If you have 30 functions to keep track of how is that more readable and maintainable than 15? Yes you have to read the for loop, but it's still a well defined function, do you not have to stop and read when you see higher order functions or combinators?
>>101208556
>Diversity is our strength.
But seriously this usually either means
1) nearly none of the functions can chained together, so you are constantly gimped
or
2) the function spec is such a clusterfuck that it's impossible to reason about, dejure functional, but defacto everything goes
>>
I just want a functional language were I can look at the last function and know the shape of it's output.
>>
>>101208606
>1) nearly none of the functions can chained together, so you are constantly gimped
You might not be able to reuse the same function in other cases that demand you refactor the function to take a global parameter to swap behaviour but you trade this off with composability. You always know a function doesn't escape its scope and it's safe to trust its signature.
>2) the function spec is such a clusterfuck that it's impossible to reason about, dejure functional, but defacto everything goes
This is a design problem, not a functional problem. You should be combining all the internal functions into a sensible API.
>>
>>101208702
>you always know a function doesn't escape it's scope
Same as in c if you just inline everything and don't abuse control flow
>This is a design problem
That belief is why there are a billion functional language, exactly 0 of which are usable.
>>
>>101208518
https://www.sevangelatos.com/john-carmack-on/

https://youtube.com/watch?v=SxdOUGdseq4

>>101208606
>Why ignore the sentence after that?
Because the performance concerns are at least a valid issue.
>If you have 30 functions to keep track of how is that more readable and maintainable than 15?
Due to referential transparency and the ease with which tests can be written for a pure function.

What do I care if the function I call goes down a call then calls 30 other functions if none of them modify state? As long as I know what output to expect for a given input, those implementation details are irrelevant.
>>
>>101208750
>Same as in c if you just inline everything and don't abuse control flow
If you allow it to happen, it will happen. You can have the discipline to write perfect side effect free Javascript with no globals on sight and with extensibility on mind, but you will eventually have to meet code written by others with no such discipline.
>That belief is why there are a billion functional language, exactly 0 of which are usable.
There aren't that many pure functional languages. Especially when most functional features get subsumed by mainstream languages.
>>
>>101208759
>referential transparency
That's no different than just using a debugger, functional languages often are passing insanely complicated expressions, much moreso than a few registers and pointers.
>what do I care
That it's brittle, any change needs either a complete redesign (or more likely you just say fuck it and add a few more functions) In c like languages there is a natural progression as you refactor
https://youtu.be/5Nc68IdNKdg?t=2689
>>
>>101208759
>What do I care if the function I call goes down a call then calls 30 other functions if none of them modify state?
Also your definition of correctness is too shallow, if the program is too slow, that's a bug. Don't act like you have the same implementation as a c language, or that yours is better cause it fulfilled some ideal mathematical notion of a function with a similar name in math; when it runs like ass.
>>
>>101208972
>if the program is too slow, that's a bug
your reading comprehension is atrocious. I already wrote that my software is not too slow for my purposes, and that I write the few performance-critical parts in an imperative style. So this is a moot point.
>>
>>101209182
how about you just shill functional programming for real? what does the code read like? saying muh maths muh functional means fuck all
>>
>>101209182
>for my purposes
I'm glad we don't share a codebase
>>
>>101199980
why not make a vm, its similar complexity to interpreter and you can just invent the instructions you need (in effect they can be the same as your interpreter functions really, but you get to serialize your bytecode). then you better understand the capabilities needed to host your language, and porting will be as simple as implementing the functions needed to execute the instruction set of your vm.
>>
>https://discuss.python.org/t/for-your-consideration-proposed-bylaws-changes-to-improve-our-membership-experience/55696/155
>CPython core developer
fucking hell
>>
>>101209344
I agree
>>
>>101209510
What's the QRD of this? Fags want to witchhunt, kick and name of shame other board members of the Python Foundation?
>>
>>101209344
you do realize that everyone was already thinking the same thing about you as soon as you wrote that you "failed to implement a prime number sieve after days of trying" right?
>>
>>101209567
Nah, they are just making faggy administrative changes and wasting everyone's time with discussions about discussions. Hopefully they will calm down in a few years.
>>
>>101201621
C#, the better java
>>
Is there any reason to use fork() instead of threads?
>>
>>101209950
yes
i will not elaborate though
>>
A day has passed
New thread doko
>>
>>101176645
You should make even and odd tail call recursive functions. Scheme optimises those to constant space.
>>
>>101209950
exec will terminate all other threads so there is one reason
>>
The best thing about APL is how it isn't afraid of using more symbols to condense code. Array programming is as big of a meme as functional programming i.e. massive. Most of the problems arising in computer programming is too much control rarity relative to clarity.
Our commitment to using a ton of long keywords for control structures has been a massive detriment to our ability to keep large tracts of code visualized in our head at once. It also ideomatizes the learned act of programming heavily into prose styling of natural language rather than a symbolic representation of visual reckoning, and thus gives reign to plethora ideologies surrounding such styles rather than a naturalized perspective derived from objective reality and its necessity.
The retardation seen in modern programming is a direct result of the languages we use. Sapir-Whorf were right.
>>
>>101210818
Had enough of shilling arena allocators?
>>
how do I curse and use slurs in C++?
>>
>>101210818
A symbol is the same thing as a word in your head
>>
haskell if he real (imperative)
import Control.Monad (forM, foldM)
import GHC.IOArray

sieve n = do
arr <- newIOArray (2, n) True
let sn = floor . sqrt . fromIntegral $ n
let gen i = takeWhile (<= n) [i * i, i * i + i..]
forM [2..sn] (\i -> do
v <- readIOArray arr i
forM (if v then gen i else []) (\j -> writeIOArray arr j False))
foldM (\acc i -> do
v <- readIOArray arr i
return $ if v then i : acc else acc) [] (reverse [2..n])

main = do
x <- sieve 1000000
print $ sum $ x
>>
File: 1584097735903.gif (1.58 MB, 500x281)
1.58 MB
1.58 MB GIF
I'm getting filtered by inheritance but I think it's a problem with me not knowing how to word my question for a Google search.
I want the child to use the same variables as the parent, but the values for those variables should be unique for each child. As far as I can tell, in C#, you do this by redefining the variable like
new float Foo
but I get the feeling that doing this for every variable isn't the right way to do it. Is there a better way?
>>
>>101211568
You indeed are asking for something that doesn't make sense, even your example isn't valid code.
It seems you're problem isn't even about inheritance, it's just about how to create instances of classes.
>>
I want to write a polymorphic engine in C but I am a noob
>>
>>101211696
>It seems you're problem isn't even about inheritance, it's just about how to create instances of classes
You're probably right. To put it another way, I've got a bunch of variables and methods I want to reuse in other scripts without just copy-pasting them (because I might change them). What term should I be looking up if I want to do that?
>>
Please help me, explain why this shitty tutorial code keeps using static ports instead of port 9001? I know it has something to do with the forking process but i genuinely cannot figure out why instead of listening on port 9001 it listens on random ports instead???

https://asmtutor.com/#lesson33
>>
>>101210818
>objective reality and its necessity
People argue over the subset of measurements to put on construction drawings -- "clean code" etc. is the same social phenomenon. That is, the debates have nothing to do with reality except in so far as the code will continue to remind the loser that they're a loser.
>>
>>101211783
What exactly are you copy pasting?
If you have a class, and your properties (member variables) and methods are declared inside that class, all you need to do is create a new instance of that class. Then you access those properties via dot notation.
You should probably try asking those questions to ChatGPT or some other AI instead of googling them.
>>
>>101211568
>I want the child to use the same variables as the parent, but the values for those variables should be unique for each child
then why do you want these variables inherited in the first place? and by "each child" do you mean each child class, or each object? because each object of a class already keeps his values to himself, unless you make shit static, in which case you give up the ability to utilize inheritance
also that's what getters and method overriding are for: the parent class can have a method to get some property and each child class overrides it to return its own value (and with a method it doesn't matter what fields it returns or uses)

if you're doing OOP you should really switch your mindset from just using fields (ie. variables), to operating on public methods (ie. functions) and keeping fields private.
>>
>>101212310
none of this is true, OOP rots your mind so much you can't even use OOP without overcomplicating most basic things
>>
File: 1719220179200887.jpg (76 KB, 664x666)
76 KB
76 KB JPG
Is the unit separator (ascii 31) fine for separating anime titles in a database?
>why
They're title synonyms (eg 'K on' for 'K-ON!'), they're stored in their own table and i group_concat them in a view for convenience
>>
File: 76744875_p0.png (415 KB, 768x1024)
415 KB
415 KB PNG
>>101211864
It took a bit of effort but ChatGPT seems to have gotten everything working. I was barking up the wrong tree and my problem had something to do with certain variables being set as readonly and not using lambda expressions when I should have.
>>
>>101212380
It's as good a separator as any, I guess.
>>
>>101212337
t. filtered by OOP
>>
>>101209898
Csharp is decent but calling it the better java is like calling it "not detroit"
Sure you can assume it's good, but by calling it "the better java" you're setting a very low bar here
>>
File: spongethink.png (1.64 MB, 1622x830)
1.64 MB
1.64 MB PNG
>Can't decide what programming language to make my game from scratch in
Help me out lads
I am planning to use SDL2 and opengl3
1. C++ (std version 20) is familiar to me and I love a lot of sepples shit, but I can't figure out how I should structure my framework (i.e setting up and managing the SDL and OpenGL state for one thing) in a manageable way.
2. Rust, though I have my grievances with it and its userbase, is actually kinda tempting to be honest, but there are some cons here too of course, mainly that I'm probably gonna end up being "filtered" by the borrow checker.
3. C# is good, and I'm tempted by it and Silk.NET, but I'm not 100% sure about it.
>>
>>101212685
I know.
>>
>>101212963
fuck off retard, nobody cares about your cashgrab app that runs like dogshit
>>
>>101213062
How does wanting to make your dream game without any existing engine equate to making a cashgrab app though? I don't see the connection anon, humor me
>>
>>101213074
>dream game
>without an engine
keep dreaming, since you can't even choose the correct tool for your non-job
>>
>>101213148
>non-job
I never said it was a job though? I know it's a hobby, and I wouldn't have it any other way.
>The correct tool
There is no correct tool. "Favorite tools" are subjective. I'm just asking for suggestions/advice on the proglang.
Additionally, who says I must use slop like Unity or Godot or Unreal? Yes, you are saying such, but I won't take advice from retards such as you.
>>
>>101213182
This isn't about favoritism, there's a correct tool, and you're not intelligent enough to see it, you already failed before you even attempted anything, you will never make a game, just stick to Unity or whatever and make your slop clone of many slops that were done 10000 times and shut the fuck up.
>>
>>101213198
>There IS a correct tool and YOU are not using it! If you don't, then you will NEVER make a game!
>I'm not a retard, you are!
>Unity's not slop, your game is slop!
>J-just shut the fuck up!
Sheesh, guess I'll just not take advice from /dpt/ if the average game "programmers" here think Big Commercial Engine is the best option.
I'll do my own research on languages and keep enginedevving, maybe just to piss you off, but also because I enjoy not being bound to an existing engine.
>>
>>101213230
yes I can see you enjoying not getting anything done while posting weak bait on /dpt/
>>
>>101213240
>he thinks my post is bait and his isn't
Lol, lmao even
Anyways, done here. Either gonna use rust or C++20, see ya tards.
>>
File: nigger.png (751 KB, 1144x499)
751 KB
751 KB PNG
>>101213250
every time
>>
>>101213250
It's just a retard posting stupid shit on a lot of threads.
Don't use Rust it sucks, especially for game dev. Sepples is fine but why not minimal/orthodox C++?
>>
>>101213375
least butthurt trannitor, shalom!
>>
When will jannies do their job and ban spamming morons?
>>
>>101213375
I see.
I like C-style C++ as much as the next guy but C++20 and its features aren't as bad as most say. Sure, there's some bloat and shit no one needs, but if the language offers pre-implemented dynamic arrays and shit, you gotta at least use that instead of rolling your own (unless the implementation is ass, but afaik C++'s STL hasn't been ass in at least 10 years.)
>>
>>101213408
Which is your definition of "moron", the "Unity is good" moron, or the people calling out that moron?
>>
>>101213414
>he thinks std::vector is good for anything
lmao
>>101213422
unity is good for retards who can't even figure out that games are made in C++, saying otherwise makes you worse than a moron
>>
>>101213432
>std::vector bad
I disagree.
>unity is good for retards
Indeed, which means it's not good for intellectuals like us.
>>
>>101213448
>I disagree
>intellectuals like us
sorry but you aren't as intelligent as you believe if you use std::vector outside prototyping, and no, I will not explain why, read its implementation and figure it out on your own, you're intelligent, right?
>>
Question for you guys:

Are local variables bad? My programming professor from ages ago abhorred local variables (variables that only existed inside of functions) and insisted that we only use global variables. EVERY variable had to be declared at the start of the program. There were rationales for this and some of them (from what I remember) is that local variables can be confused with global variables and that multiple programmers could be working on the same code and get confused and documenting the code could get complicated and... and... and...

He always used to harp on the fact that he was a real-world programmer before he taught and that these were always rules that he wished that he were taught before he began programming.

Therefore, are local variables really the Son of Satan or was he full of shit? Thanks.
>>
>>101213414
If you're already comfortable with it then sure, go for it. The main issue for me is, if you aren't careful, so many templates kill your compile times and I hate the
>Don't use <language feature>
>Use std::<language feature>

But C++ is still good when you need to get things done
>>
>>101213448
Please stop replying to the baiting nigger
>>
>>101213462
how many templates do you use that it affects your compile times at all?
>>
>>101213461
Was this guy like 65+ years old and only programmed in basic or some shit?
>>
>>101213489
A lot of the standard library is templated
>>
>>101213461
programming practices taught by professors are almost always wrong, this being a particularly egregious case. in real work the only global variables that pass code review are constant/immutable values
>>
>>101213514
so don't use the standard library?
>>
>>101213528
isn't that his point?
>>
>>101213527
the industry loves OOP, and OOPtards use a lot of singletons, which are globals wrapped under 3 levels of boilerplate
>>101213532
standard library is for standard things, think different
>>
>>101213528
More so by using modern C++ you're forced into using a lot of templates because that's how the features are implemented.
>>
>>101213535
>OOPtards use a lot of singletons, which are globals wrapped under 3 levels of boilerplate
Given that I have a CRTP Singleton class, I feel personally attacked.
>>
>>101213552
name one "modern" feature that forces you to use templates that aren't
>std::span
>std::string_view
no, std::string and std::vector are garbage, all std::*map variants are garbage, all standard data structures in fact are worthless because they use shitty old and cumbersome malloc/free style API which is terrible for getting anything meaningful done This includes unique/shared_ptr. Modern programming is bulk and parallel processing, which requires fast allocations and even faster massive bulk deallocations, not individual tranny billions of mallocs and billions of frees, individually called on every few bytes of your terabytes of data.
>>
>>101213501
He's be 65+ at this point (it was a long time ago). He used to always have tales of when he programmed in the real world and how something would screw up and they'd trace the flaw back because someone mistyped a single variable or they used a local variable when they should have used the global one or vice versa...

That reminds me: How often should a variable be re-used because this one pissed him off as well. A variable is only to be used for one purpose. He used the example of a Coke can and that if it's a Coke can, only Coke should be in it, not first Coke and then milk and then orange juice, etc. so forth. And then he would spout times of other programming tales for when more code failed and it was because some programmer wanted to save space and re-use variables and didn't do something right like empty the variable or whatever...
>>
>>101213603
let me guess, he invented hungarian notation
>>
>>101213535
that's not false, but then again, the wrapping layer that makes you go from a global struct instance to a singleton is useful for a reason, or in other words, injecting a singleton instead of pointing to a global struct instance is enough of a difference to make me say that >>101213527 holds true
>>
>>101213616
>injecting a singleton
pray do tell me the meaningful difference between
new Object(GLOBAL_VALUE);
as opposed to
new Object(getSingleton());
, other than the latter having more overhead.
>>
>>101213628
You missed the part where you have some framework "inject" the singleton in your class as a member, rather than having to call getSingleton(), so you can pretend what you have isn't a global variable.
>>
>>101213628
lazy initialization
injecting an interface to swap out implementations
easier to test (mainly just a corollary of the point above)
enforces the invariant that 1 object of that type can exist
>>
>>101213653
>lazy programming
I really hate this, everything I do is explicit at all times, but that's probably why I don't use singletons, I just create that one class I need at specific point and it's basically used globally.
>>101213649
>framework
the joys of corporate programming, you're right, when you are under so many layers of cargo culting, I guess globals simply aren't ever a choice.
>>
>>101213610
Actually, no (I had to look that up).

I remember that variables had to be capital letters, starting with AA (then BB, then CC, etc.) going to ZZ and then, if you needed more variables, start at AAA and go from there.

This way, you would never mistakenly type a variable with word that did something in a language, like "substring" or anything likes that.

And you also had to comment every single line of code. He was extremely insistent on that. EVERY single line of code had to be fully documented. The standard was that he could take comments, hand them to someone who knew nothing about programming and they would be able to understand what that line of code did.

I'm guessing, at this point, that everything he taught us was full of shit. Oh well. At least his class was entertaining.
>>
>>101213688
commenting every part of code is just lazy and brainless on his part, here teachers don't give a fuck about comments, they read your code and force you to answer questions directly so you can't just copy paste comments that you don't understand.
>>
>>101213688
How in the fuck do people like this get into teaching positions?
>>
>>101213713
academia is for people who are complete failures in life and can only work in hypotheticals, without actually practising anything they preach, just look at modern "science", big bang theory is christcuck paraphrasing of genesis book, and it's widely accepted because well it just is plausible ok? God just snapped his fingers like thanos and then BOOM fr fr no cap ON GOD, it happened, universe was born.

My personal theory is that universe formed when OP's mom farted though.
>>
>>101213703
I suppose teachers have to do it that way now you're going to have a not insignificant portion of students handing in AI slop for their assignments.
>>
>>101213733
I finished highschool a decade before chatgpt was a thing, my teacher had doctorate in computer science somehow so she might be an exception.
>>
>>101209950
do clone
>>
>>101213649
you don't need any overarching structure to use dependency injection, you're quite literally just declaring the singleton as a field
>>
>>101213739
In university, I luckily did have any of those ridiculous >>101213688 types. There was one guy that was a bit """OOP professional""" going on about """"""""""design patterns'"""""""" from their holy bible, but fortunately that was just one class.
>>
>>101213754
did not have*
>>
>>101211568
>I want the child to use the same variables as the parent, but the values for those variables should be unique for each child.
so like you just want to create a new structure? yeah that is what happens when you do
Fruit apple
={
...

like? if you want to take methods from a parent class you just make another class like
Class first;
Class second : first{
//declare that you are goign to be using some member of first, this member is not "shared", the wording is just weird when you think of it as using "members", you are just sharing words the compiler will understand at compile time between the classes
};
>>
File: output.png (240 KB, 1024x768)
240 KB
240 KB PNG
>>101206616
>>101206642
i was copying the glyph's grayscale alpha across all channels during rgba conversion (sob sob)
>>
>>101213461
If he programmed in some language with dynamic scoping, this convention could make some sense, although even then I'd prefer something like writing globals with capital letters and locals in lowercase.

In a modern language with lexical scoping, this is just silly. I actively avoid global variables as much as possible.

>>101213713
Those who can, do.

Those who can't, teach.
>>
File: my.k&r.jpg (209 KB, 1572x1080)
209 KB
209 KB JPG
>>101194591
just found my copy of K&R C. it belonged once to my father, and he passed it down to me. maybe one day I will pass it down to my children.
>>
>>101214041
thought the red := was arabic initially, nice find anon
>>
>>101211491
Congrats bro you invented apl circa 1965
>>
File: jan-bielecki-jezyk-c.png (3.85 MB, 1512x2016)
3.85 MB
3.85 MB PNG
>>101214041
Do you have picrel?
>>
>>101214115
no, I don't think I ever had it. I left most of my ancient programming scrolls behind when I was moving houses, but I decided to keep K&R.
>>
>>101213882
looks better now
what about letter spacing?
>>
>>101194591
read manual, now gonna connect the arduino for the first time in a couple of weeks and do some cool stuff
>>
>>101213688
A soulful schizo. A relic from the more civilized age when coding was about getting shit done and having fun, and not about serving business needs or some bullshit. I envy you a little. I had a friend who used to code for uni mainframes in 70s, but somehow we never talked about coding.
>>
>>101212963
Unironically use Swift

Native C++ support, null safety, a lot of ideas and concepts that were half assed implemented in cepples have proper implementation in Swift.
>>
File: primes.png (94 KB, 925x756)
94 KB
94 KB PNG
>>101208048
just woke up, decided to make another version
>>
>>101215431
>coding
yeah, i bet he never talked to you about programming.
>>
File: 1713729073791574.png (829 KB, 1279x825)
829 KB
829 KB PNG
>>101194591
I have been working on porting over a torrent client I wrote recently to my OS. Found a lot of bugs in my file system code and TCP stack + a lot of things that I had to optimize. But I got it working with roughly 4 MB/s download speed(ignore screenshot the timer is not correct). Still a ton of things to optimize as on my host OS it can manage 90+ MB/s download speeds.
>>
File: 12454.png (33 KB, 608x606)
33 KB
33 KB PNG
>>101215919
I unironically want to get into osdev.
Recently I've been reminiscing about "OSes" and IPLs on old game consoles (like, 6th and 7th gen consoles, even a bit of 8th gen with 3DS and Wii U). Those things had so much unironic soul. The menus had ambient music, the UI graphics and UI sound effects had character, etc.Nowadays, game console OSes are unironically lacking of that kind of soul. The switch menu having no music is a travesty. I want to make an OS that captures that old feel now, since the official ones won't.
>>
>>101216064
>unironically want
>unironic soul
>unironically lacking
>>
>>101216137
sorry I unironically say unironic so much, anon
>>
>>101215919
How do you even make an OS anyways? What tutorials did you follow?
>>
>>101216215
osdev wiki to get basic things working, learn about simple concepts such as scheduling, what is a process etc. Also reading the intel CPU, ELF, hardware manuals, RFCs. There is no real "tutorial" you can follow since things will quickly start getting very specific to your tastes(especially the more complicated parts). But there are a few small tutorials out there and a bunch of github repos which can give you a general idea of how certain things are implemented. But most tutorials and github repos do things wrong very often.

>>101216064
It is fun I would recommend it. You could do a similar thing to what the SerenityOS dev did where he just started making the GUI toolkit as a normal program on linux with SDL. Then one day he wrote a very simple kernel that could draw to the screen and he ported over the GUI toolkit he made directly into the kernel(which should be fairly easy). After that you can move certain things into their own userland programs and add drivers, filesystems etc.
>>
>>101214041
you won't breed.
>>
>>101216419
that's anti-polish discrimination
>>
>>101214041
this post made me think about programming languages being translated from english to other spoken languages
BRB, looking up what K&R C looks like in japanese.
>>
>>101216525
https://9cguide.appspot.com/c_kandr.html
I barely know japanese, so I'm relying on a JP->ENG dictionary and mtl at the moment:
The Bible of C?
If you are an aspiring C language user, you have probably heard of the book K&R.
K&R is the world's first decent C language manual.
The book was a huge hit in the industry, in part because it was written by the C language developers themselves.
K&R is also considered the biggest bestseller in the computer industry.
This book goes into the very fine details of the C language,
At that time, there was no such thing as a decent standard for the C language,
In those days, there was no decent standard for C, so a C compiler was made based on this K&R.
...
>>
>>101215919
based. Architecture?
>>
>>101216137
>being this much of a newfag
>>
>>101216545
(cont.)
"However, the author does not recommend that you all read the K&R.
You should not read it.
The first reason is that the explanations are too confusing.
You would have to be quite familiar with the C language to read this book.
In the first place, the book itself does not seem to be designed for beginners to read.
The second reason is that the sample programs abuse pointers.
...
"
>>
>>101213754
>There was one guy that was a bit """OOP professional""" going on about """"""""""design patterns'"""""""" from their holy bible, but fortunately that was just one class.
I too had a teacher that would do the ass-backwards thing of giving a design pattern and telling us to implement something that uses it. That's wrong, that's not how problem solving works.
Design patterns aren't bad. Academics teaching them is what's bad.
>>
>>101216547
x86 I wish to port it over to x86_64 and abandon 32 bit entirely but I also hate writing paging/early boot code.
>>
>>101216610
>hate early boot code.
so are you doing the pic bios thing? i dont know much about 32bit
>paging
i got that out of the way in a couple of days but i am getting driver anxiety, couldnt even get info on my hardware from oem
>>
>>101216681
>so are you doing the pic bios thing? i dont know much about 32bit
No I am just using GRUB to handle all the really early BIOS stuff and ELF loading. But the code right after is a huge pain. It is just setting up paging in assembly and making sure that your memory allocator can bootstrap itself. Memory allocators and paging code requires that you can give it memory, which is difficult because you don't have a memory allocator to use yet. I wrote it a really long time ago and have not looked at it since.
>>
What point is trying to be made here? That the compiler doesn't wipe your ass and pour a drink for you unless you ask it too? Why are you calling a function that you have no spec for anyways?
>but if you do misuse a function don't you want the compiler to catch that
If you can't even understand input your function takes you have no business programming.
Besides there are plenty of uses for untyped function inputs. Even just filtering typeniggers from shitting up your code is worth it's weight in gold.
>>
>>101216922
grub left you the memory map somewhere and the ramsticks should be free reign automatically (i am forgetting right now wether entries to the firmware memmap have a definite range because its been a while) but anyway you should be parsing acpi to reserve more for memory mapped things and then set memory up, there are default free ranges, ibm is i think 0x0 - 640kb?
>>
>>101217362
my gcc doesnt even compile without (void)
>>
>>101217404
yo dudee you can do like layers of interrupt vectors to communicate the 64bit address at which you made the structures with bsp, thats so crazy kek
>>
>>101217404
No need to parse APCI stuff since GRUB will already do that for you and tell you in the memory map which areas you can use.

But none of those things are the problem. It is mostly just about having to move the structure of the cr3 you setup before into my own data structures. But those things require some allocations themselves which creates very ugly code.
>>
>>101217362
People think “undefined behavior” always behaves in the worst way possible. In MSVC, GCC, and ICC, it almost always results in sensible behavior though.
>>
File: japanese dicparser.png (989 KB, 1920x1080)
989 KB
989 KB PNG
>>101216525
there's a japanese version of SICP
https://github.com/minghai/sicp-pdf/
>>
>>101217362
I'm sorry that basic logic offends you.
>>
>>101214041
pretty
>>
>>101216525
Fuck, just realize I mistyped "programming language books" as just "programming languages"
Though C with japanese defines for the syntax would be kinda funny/neat
>>
File: 1516290309699.jpg (35 KB, 552x736)
35 KB
35 KB JPG
I'm taking my first foray into PowerShell scripting, and after a few days of working on it in my spare time I have figured out how to install a library from nuget.org without downloading any of the dozen nearly-identical programs with included package managers that every online resource I could find assumed I was using. I would have had to install every dependency manually if this library actually had any, but it didn't so I just used the -SkipDependencies flag to stop the "DependencyLoop" error which seems to be the last hurdle.

Now I can begin coding
>>
>>101217681
>it almost always results in sensible behavior though
That is a retarded way of thinking. If you are using compiler optimizations you will run into problems. You should assume it will do the worst thing possible because that is what will happen in production.
>>
>>101217681
i have had the compiler output segfaults on things like this:
struct something  smn = create_struct(parameters);
if (somecond){
somefunc(smn->member);
else{ //other code

never trust the compiler.
>>
File: overhang_cove.webm (2.28 MB, 1280x720)
2.28 MB
2.28 MB WEBM
working on a 3D Dwarf Fortress Daggerfall-like in Vulkan and C.

Currently trying to make 3D Perlin noise give me caves and caverns.
>>
Debugging advice, hot off the presses https://youtu.be/jjCfAg_gtDw?si=vPHJALZ_leW8IHcE&t=7120
>>
>>101218396
Seems legit. Where's ub in that?
>>
>>101218471
in him dereferencing null as is appropriate to dunning krugers
>>
>>101218471
branch prediction doesnt care wether the pointer to the struct is null or not, my example was trash, it was this:
//avoiding speculative execution segfault on nullptr
__attribute__((optimize("O0"))) void wrapper(void){
mmap_read_unlock(us->mm);
}
void exit_mod(void){
if (dontworryaboutit){ iounmap(dontworryaboutit);}
if (dontworryaboutit){ vfree(dontworryaboutit);}
if (us) { wrapper();}
}

i tried a switch statement, got "optimized" away, didnt want to write it in assembly since these are statics so i had to do this nonsense
>>
>>101218982
>do something retarded, cry about retarded results
cniles, not even once
>>
R8 my modern C++
#include <iostream>
#include <vector>

int main()
{
std::vector<int> vec { 11, 15, 20 };
for (int x: vec) {
if (x % 2)
vec.push_back(x);

std::cout << x << std::endl;
}
}
>>
>>101219237
pls be trolling
>>
>>101219248
This.
You aren't even using std::print
>>
>>101219248
Something wrong? :^)

>>101219253
Tried, I don't have it yet
>>
>>101219269
>Something wrong? :^)
int main() {
>>
>>101219237
you just did a hecking iterator invalidation
>>
>>101219380
just shows how terrible stl really is, my growable array implementation doesn't have this problem
>>
>>101219427
my arena allocator doesnt have this problem either
>>
>>101219427
>my growable array implementation doesn't have this proble--
*segmentation fault: core dumped*
>>
>>101219607
never happened to me, consider not being brown
>>
File: rc.png (46 KB, 1804x1126)
46 KB
46 KB PNG
>>101219237
I don't know any c++
>2 includes
>no .h or path
So there are built into the language or what?
>no stdio
I guess iostream is your io functions
>int main()
seems fine, probably is slightly different than c, considering the void stuff someone posted about earlier itt
>{
I assume this is the same as in c, a block of code and scope for variables
>std::vector<int> vec { 11, 15, 20 };
>std::vector
Taken from the 2nd include file
><int>
that you want the integer version of the datatype?
>vec
A vector? Is that a real array, meaning not just a pointer? Or is it just a dynamic array?
>{11 , 15, 20}
It has 3 elements, 11, 15 and 20; and those can be any valid expression.
>for
for loop, a generalization of a while loop that includes (re)initialization, conditional and assignment. At least it means that in c
>for (int x: vec)
This looks more like a loop you would see in a shell-like language, actually I use rc which is pretty much just this, see pic rel
>if ( x %2 )
> vec.push_back(x);
If the loop variable is odd then run vec.push_back(x) on x, which I assume modifies the array in some way, maybe a left shift in a way generalized to a vector element?

considering the last line it might be a defer (so the loop sends 20 then 15 and 11)?
>std::cout
I guess this is stdout? not sure what the c means
> <<x
send x to std out
> << std::endl
I have no clue.

After writing the above I ran it and got
11
6
-1042887834
So i have no clue. I'm sorry this happened to c++ users.
>>
>>101219691
>datatype
I don't know why I said this, I meant to write data structure, but I don't know which is correct
>>
>>101219718
I mean, datatype is obviously wrong. I probably just said it cause <int> threw me
>>
>>101219691
<> is some weird operator overload nonsense, i wouldnt worry about it
i wouldnt use the stl in the first place.
>>
>>101219691
>wall of text
filtered by c++ lmao, jeets can learn this shit in a few days senpai ne.
>>
>>101219896
No man alive has truly learned C++
>>
>>101219989
no man alive has truly learned everything, very poor excuse to being a low IQ nigger who knows nothing
>>
>>101220016
fac
>>101219989
fag
>>
>Oh, those Rust safety features
>Don't mind me, just absorbing them into the amorphous C++ blob
https://www.youtube.com/watch?v=5Q1awoAwBgQ
>>
>>101220639
all those keywords
>>
>>101194591
this stupid display thing is not saying nigger and i dont know why
>>
File: 1639925705717.jpg (92 KB, 900x937)
92 KB
92 KB JPG
Developer convenience or user's system resources?
WinUI 3 and ElectronJS are very quick and convenient but they're very bloated, should i care more about user or myself?
>>
>>101220639
>1:28:00
I don't have time for this, I literally spend 0 time checking safety of my code because it just works by default. An intelligent white man wrote it, all compiler has to do is trust me.
>>
>>101220970
>an intelligent white man
Are you sure about that?
Are you sure you're really white?
>>
>>101220964
electron is impossible to port to linux, the arduino ide doesnt work half the time and when it works it takes 20 seconds to intialize.
>>
>>101220992
>>101220992
>>101220992
New
>>
>>101220977
unlike tranny who needs a verification for every little thing, I do not...
>>
>>101220964
would sexo so hard
>>
File: sicp snake.png (27 KB, 666x768)
27 KB
27 KB PNG
>>
>>101221118
new one

>>101221118
move over
>>
>>101220639
I wonder what a day is like in the minds of people who think c's "safety issues" are real and important.
>>
>4 /dpt/ threads
Lol, we're back to the drama
>>
>>101221348
>minds
lol



[Advertise on 4chan]

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.