[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

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: cover.jpg (96 KB, 600x765)
96 KB
96 KB JPG
What meme language are you making /g/?
Prev:>>101220992
>>
Erlang
>>
>>101249866
>Power the telecommunication infrastructure
>meme
>>
>>101249911
Is this like those companies that had one guy write some 100 line D utility program 10 years ago, and then people going on about how the company is "built on D"?
>>
File: 1716032014322780.jpg (46 KB, 1024x1024)
46 KB
46 KB JPG
I only develop for windows, mac and linux aren't attractive
>>
>>101250039
this but ios
>>
>>101250039
>Frogposter
>Says something retarded
A tale as old as time.
>>
>>101249828
H!
>>
File: 1700734254159508.png (1.01 MB, 1467x1005)
1.01 MB
1.01 MB PNG
So I'm looking at this crazy-ass program that compiles itself. It's from IOCCC 1989 by Jay Vosburgh
[intentional blank line]
#include <stdio.h>
#define QQ 1
#define TT 1
#define cc main(c,v) int c; char **v;{char tt[12],qq[7]; int q=0,o=1,l=1,m=1;struct {int c;} f;
#define incest qq[6]='\0';tt[11]='\0';if(QQ==atoi(v[1])+1){(void)fprintf(stderr,"%s factorial = %d\n",v[1], TT);exit(1);}o=c+f
#define x ;while(EOF!=(o=getchar())){if(l && q=='Q' && o=='Q'){l=0;(void)getchar();(void)fread(qq,6,1,stdin);(void)printf("Q %6d",atoi(qq)+1);}else
if(m && q=='T' && o=='T'){m=0;(void)fread(tt,11,1,stdin);(void)printf("T %9d\n",atoi(tt)*QQ);}else {q=o;(void)putchar(o);}}exit(0);}
cc incest.c -o x
#define zxc ;{/*
cat incest.c | x $1 >! x1
if ($status != 0) then
exit
endif
mv x1 incest.c
chmod +x incest.c
exec incest.c $1
exit
*/

see pic rel for an explanation
and https://ioccc-src.github.io/temp-test-ioccc/1989/fubar/index.html for submission

However, being a noob, I'm confused about one part in the "de-entangled" output:
o=c+f -o;

If I try to compile this bit (which you're not supposed to, you're supposed to always start with the original script and fubar.c), it complains about
>error: invalid operands to binary + (have ‘int’ and ‘struct <anonymous>’)

So, my question is:
how do you sum a struct and an int like this? Isn't this syntax wrong?
>>
>>101249990
Nah it's widely used but there are few erlang jobs
>>
File: ‪ 6890965321.gif (1.15 MB, 197x192)
1.15 MB
1.15 MB GIF
I'm experimenting with WinUI 3 publishing and it turned out that i can create a portable exe, some people on /g/ lied to me and said i can't do that, it's an okish experience but i think i'm forced to use msix instead of traditional installer
>>101250052
Based swift dev
>>
>>101249911
It's meme outside telecoms
>>
File: firefox_9YMahzwFDX.png (4 KB, 295x124)
4 KB
4 KB PNG
I actually want to make a memelang given how I am dissatisfied with practically every language. Even if I end up like the guy who made D and essentially make the language I think is the most good but nobody uses, it would be fun.
But how do I make a memelang?
>>
File: .png (6 KB, 590x41)
6 KB
6 KB PNG
>>101250201
that's a typo
"ouroboros" is a define, "x" is a define
so the line "cc ouroboros.c -o x" gets split into
(ouroboros)(.c -o )(x)

and the expansion results in
(...}o=c+f)(.c -o )(;while...)

so it's actually
o=c+f.c -o ;

you can do
gcc -E fubar.c result.out
and ctrl+f "c+f"
see picrel
>>
>>101250424
invent the syntax, attempt writing bnf just to get clarity. learn to write recursive descent parsers in c. create an enum with OP_FUNCTION1... then try to parse syntax into your bytecode. make a big switch statement in a loop that implements all of these builtin functions.
>>
>>101250424
>Even if I end up like the guy who made D
OH RIGHT right right, worst case is you end up as an author of multiple C++ books while having a pHD in computer science with accepted proposals to the C++ standard and also worked on your 'meme' language 15+ years. WORST CASE.
>>
>>101250704
I don't mean like he's in a bad place, I mean like he made the language he thinks is the ideal language and practically noone uses it
>>
>>101250704
lole hi walter
>>
File: p.jpg (415 KB, 684x909)
415 KB
415 KB JPG
!
>>
>>101250704
he means walter, not andrei lmao
>>
>>101250039
I only develop for windows but I do all my development in linux
>>
>>101250443
Ah! I see, thanks for pointing out the typo, and also for mentioning the -E flag with gcc. Wasn't aware that was a thing for preprocessor. It makes sense now
[blank line]
#include <stdio.h>
#include <stdlib.h>
#define QQ 4
#define TT 6

int main(int c, char **v)
{
char tt[12];
char qq[7];
int q = 0;
int o = 1;
int l = 1;
int m = 1;
struct {
int c;
} f;
qq[6] = '\0';
tt[11] = '\0';
if (QQ == atoi(v[1]) + 1) {
(void)fprintf(stderr,"%s factorial = %d\n",v[1], TT);
exit(1);
}
o = c + f.c -o ;
while (EOF != (o = getchar())) {
if (l && q == 'Q' && o == 'Q') {
l = 0;
(void)getchar();
(void)fread(qq, 6, 1, stdin);
(void)printf("Q %6d", atoi(qq) + 1);
} else if (m && q == 'T' && o == 'T') {
m = 0;
(void)fread(tt, 11, 1, stdin);
(void)printf("T %9d\n", atoi(tt) * QQ);
} else {
q = o;
(void)putchar(o);
}
}
exit(0);
}

/* this was called with ./fubar 3 */
/* 3! = 6 */
and now running ./ouroboros with 3 also yields the right output
>>
>>101251407
I accidentally'd a codeblock inside a codeblock, that's interesting
>>
so docker containers are just VMs basically?
>>
>>101251542
Not quite. Most containers are more lightweight, and will share the same kernel as the host, but just be isolated from everything else.
But sometimes containers are true VMs.
>>
The code will be closed source. It will not be malicious. Trannies will not fork my project and run it into the ground. You will accept it.
>>
File: 414ZNWVCQCL.jpg (19 KB, 353x500)
19 KB
19 KB JPG
Why are c "programmers" like this
>>
>>101251719
I assure you there are no "chicks" programming in c.
>>
>Boss: built our own Excel from scratch
>Me: that'll take hundreds of hours
>Boss: do it in 50
real conversation
>>
File: 1574667018395.jpg (564 KB, 990x1200)
564 KB
564 KB JPG
I'm writing some networking stuff, and the maximum size a message for this protocol is is 128MiB, but the typical size will be MUCH smaller.
Having to write a streaming parser seems kind of annoying, but having 128MiB lying around unused, or having to do a resizeable array seems annoying too.

So I was thinking about this:
size_t len = 0x8000000;
void *buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1, 0);

while (1) {
// Done with proper polling and likely multiple calls of this, which offsets/lengths properly tracked.
// This is just to show the point.
ssize_t nread = recv(sock, buf, len, 0);

parse_message(buf, nread);

madvise(buf, len, MADV_DONTNEED);
}

mmap won't actually allocate any memory until I actually use the pages, so while I'm fucking around with small messages, I'll only be using a small handful of memory.
And madvise(MADV_DONTNEED) will actually free the pages, so if I get a big message, I won't have a bunch of unused memory sitting around for the rest of the program.

Is my understanding of this correct, and is there anything wrong with doing it this way, outside of portability?
>>
>>101252041
>lines and colums
>can go through them with the arrows
>save and load custom format
that is a really fucking simple task you dimwit.
>>
>>101252046
it is fine
>>
>>101252163
t. never used excel
>>
>>101252175
no it's not
>>101252046
>Having to write a streaming parser seems kind of annoying
why write anything at all then?
>>
>>101252242
>why write anything at all then?
I mean a parser that is able to stop and restart in the middle of reading, meaning you need to properly store/serialize all of your state.
It's obviously possible, but it's easier to just not.

>no it's not
Why not?
>>
>>101252276
>why not?
nta but other people have solved the problem. just steal their implementation? it's either blocks or streaming. if you don't have consistent block sizes (or don't want to)... then stream it.
>>
File: int skeletonBoners.png (108 KB, 656x436)
108 KB
108 KB PNG
Do compilers/runtimes eliminate automatic variables as soon as they leave their scope or do they hang around for some arbitrary amount of time?
Also can they further restrict the scope of a variable if it falls out of reference before the end of a scope?
Like for example
var cond bool
if cond {
// ...
}
// cond is no longer used; reaped by the runtime here
// more code is here before scope terminates


Normally I tighten scope manually, with braces or whatever language feature.
>>
File: thecrane.jpg (116 KB, 411x700)
116 KB
116 KB JPG
Newbie question:
You must flip a C89 style boolean (using int, there's no bool). Using a conditional because we don't want to set the variable to the same thing it's already set to (though this may already get optimized away by the compiler, not sure)

Which one do you prefer? In terms of readability

A.
#define THING_EMPTY 0
#define THING_POPULATED 1
...
if (thing_state == THING_EMPTY) {
thing_state = THING_POPULATED;
}


B.
#define NO 0
#define YES 1
...
if (thing_populated == NO) {
thing_populated = YES;
}


C.
#define NO 0
#define YES 1
...
if !(thing_populated) {
thing_populated = YES;
}


In B and C, we're using the "positive" case as a variable name because I don't want to get into silly shit with double negatives (ie, !(empty) )
>>
>>101252725
thing_state = !!thing_state;
>>
Holy shit I love programming. I wish I could code 16 hours a day and then dream of it.
>>
>>101252725
(Pretend "THING_" isn't there, it's easier to just say EMPTY/POPULATED for a symbolic constant that can get reused in any appropriate context)
>>
>>101252777
what's stopping you?
>>
>>101253096
Sometimes I have to eat or poo. But mostly stupid stuff like meetings. This week I have been almost only programming though and it's great.
>>
>>101252751
Reading my own post again an hour later: just the one !.
Two !s are for forcing an arbitrary int value into 0/1.
>>
>>101253319
or != 0
>>
150 days to aoc
>>
>>101253666
>150
>1+5+0= 6
>101253
>1+0+1+2+5+3 = 12 = 6+6
>666
what's the most satanic problem we can have?
>>
>>101251736
That's a baby duck
>>
>>101253726
they're called ducklings, and it isn't
>>
>>101253740
A childish word used only by children
You have baby duck syndrome
>>
>>101253818
>each animal species should have only one noun to refer to it
average american, touch grass
>>
I still don't understand "const" after years of coding...
Can anyone explain in retard words pls
>>
>>101253895
https://stackoverflow.com/questions/10906595/is-const-a-lie-since-const-can-be-cast-away
>>
>>101253895
It's simple, it's just the opposite of what happens when const is not there.
>>
>>101252390
you are retarded
>>
>>101250412
So better than Rust then, Rust is a meme everywhere
>>
>>101250412
It is not even used in telecoms anymore

>>101250226
Not anymore, most if not all large projects have switched to other languages.
>>
File: FruitWarpAnimation.webm (99 KB, 384x384)
99 KB
99 KB WEBM
>>101249828
This video is one continuous walk through the training input space of a diffusion network trained on some fruit images.
>>
>>101249828
Penislang
>>
>>101254691
the pen is langier than the sword



[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.