What are you working on, Jow Forums?
Last thread:
What are you working on, Jow Forums?
Last thread:
JavaScript rocks!
How do we get freshman to stop making shitty projects in C?
First for golang is trash I'll just use JS instead at least it fucking works who needs types anyway they're a crutch.
Fuck C and Go
by shilling rust and nim on /dpt/
Make sure the students you recruit aren't illiterate pajeets, brainlet SJW or tranny soi boy faggots that have "emotional episodes" every fucking time you mention pointers.
you're a fucking meme
show them the C++37 standard
praise kek
Why is GCC so garbage? It's making so many assumptions and dumping so much unwanted shit on my executables it's not even funny. Why must GNU shit infect everything?
It's a C compiler written in C++. There's nothing good about it.
-s
What's the simplest programming language after Brainfuck?
That doesn't do shit. It's literally overriding my functions with its own builtin libc shit. Even though my program is -ffreestanding -nostdlib embedded stuff.
No wonder people ship their own compiler for their boards
Is clang any better? What are other C compilers worth using? It's not even a complex project. I don't need ridiculous optimization or anything. It just needs to emit small fucking code with 0 bullshit attached
Given an expression string exp, write a program
to examine whether the pairs and the orders of
"{","}","(",")","[","]" are correct in exp.
For example,
"[()]{}{[()()]()}" -> true
"[(])" -> false
use a stack retard.
I personally love Clang. Never checked output size though.
Whitespace.
import stack: the problem
Can you run objdump on a clang executable and post the result?
>2 operations
just give up now
i know the solution retard
just wanted to see how other people would do it
yes you have to use a stack but with a little caveat
A hello world in C is 8k
{[( => push
}]) => pop and compare, return on mismatch or nothing to pop.
Just iterate with a for loop over the string, put all opening paranthesis like { [ ( on the stack and everytime a paranthesis closes you check if its counterpart was the last on the stack,
if not then false,
if yes then remove from stack and continue.
Wrong.
ok then i would use 2 pointers into the string to simulate a stack just in case the input string is 8 gorillion symmetric brackets
Yeah well my mission is to cut that down to tiny-elf level. I just want to see what symbols it puts in the executable. Believe me when I say GCC generates a LOT of cruft when you statically link everything. Even when I remove the libc.
>8K
>needing to include the std library
int puts(const char *s);
int main() {
puts("Hello World!");
return 0;
}
Bro how the fuck do I learn how to use Maven. Why is it so difficult to get a simple "Hello World" when utilizing this structure?
>apache
use a language with a native package manager + build system.
This is the only amount of effort I'll put into this crap.
int main()
{
int ch;
char stack[1024];
size_t sp = 0;
while ((ch = getchar()) != EOF) {
switch (ch) {
case '{':
case '(':
case '[':
/* fuck error checking for this shit */
stack[sp++] = ch;
break;
case '}':
if (sp == 0 || stack[--sp] != '{') return 1;
break;
case ')':
if (sp == 0 || stack[--sp] != '(') return 1;
break;
case ']':
if (sp == 0 || stack[--sp] != '[') return 1;
break;
default: break;
}
}
return (sp != 0);
}
and what's that language
>I'll put into this crap.
programming exercises are fun.
do you even have a job at programming ?
>function templates cannot be partially specialized
why
NIm, D , Crystal, Rust, etc
>char stack[1024]
>1024
w00t i got r00t
Well, you really can't do partial function/method specialization however you can do overloading
It's fun when they're challenging, at least a little bit. I had no fun writing that.
don't think a double pointer would work, you would have to remember what has been canceled and what hasn't
this question is literally fizzbuzz version 2. what caveat?
dict = {')':'(',']':'[','}':'{'}
the rest you can do
you didn't answer my question
do you even have a job at programming ?
/(?
Overloading undermines what I'm trying to do. Specialization for function templates preserves the template-id.
yes I do.
is this version right
def solve(exp):
stack = []
obracket = ["(", "{", "["]
cbracket = [")", "}", "]"]
for c in exp:
if c in obracket:
stack.append(obracket.index(c))
else:
if cbracket.index(c) != stack.pop():
return False
return not len(stack)
the solution is use a minimal function template that wraps metafunctions that handle overload dispatching and the composition of the actual underling function itself
Who /AWS/ here?
me
Lambda, Rekognition, Gateway, RDS
*that handle implementation specialization
really the same shit at that level though
>you would have to remember what has been canceled and what hasn't
ok 2 pointers and the "empty index"
way more safe and efficient than copying the string
Lisp is the most powerful programming language.
I'd love to, but unfortunately I have to use Java at the moment. I fucking hate Java, and I fucking hate maven so far.
Submit to your professor and make him proud.
def ass(s):
left = '({['
right = ')}]'
nigger = []
for c in s:
if c in left : nigger.append(c)
elif c in right:
try: int('0' + 'a' * (left.index(nigger.pop()) - right.index(c)))
except : return False
return True
print(ass("(((kikes)))"))
print(ass('}{((}()))}'))
print(ass('[()]{}{[()()]()}'))
rth
Pop pop pop watch those niggas drop.
You’re a dumbass that can’t program right
truly epic
I would be pretty impressed if you could exploit that program using only {, ( and [ in input but I doubt it's possible. There is ASCII only shellcode but this is harder.
is the program wrong?
nice copypasta bug in the first if, pajeet
>that last if-else
...
return stack.isEmpty();
No
it should be exp[i]
Nice. I'm working on plumbing. Connecting the various AWS compute, event and storage services to something that resembles a sensible architecture. Going to start a bigger AWS project soon so I'm trying to get some bigger picture experience first.
>tfw googled "AWS plumbing"
also where's the check for right brackets lol
ah fuck, should have actually looked at what I wrote before I posted.
I don't blame you, their service names are retarded. Second only to their icons.
expeditedssl.com
kek
>writing my own lisp dialect w/ interpreter in C
>realize that the remaining language features I need to implement can all be written in the lisp I've created
it's actually easier to write a non-vulnerable solution
#include
typedef struct Match {
char c;
struct Match *next;
} Match;
int match(char const *str, Match *m)
{
if (!*str) return !m;
Match nm = { *str, m };
switch (*str) {
case '}':
if (m && m->c == '{') return match(str + 1, m->next);
else return 0;
case ']':
if (m && m->c == '[') return match(str + 1, m->next);
else return 0;
case ')':
if (m && m->c == '(') return match(str + 1, m->next);
else return 0;
case '(':
case '{':
case '[':
return match(str + 1, &nm);
default:
return match(str + 1, m);
}
}
int main()
{
printf("%d\n", match("()", NULL));
printf("%d\n", match("(]", NULL));
printf("%d\n", match("({})", NULL));
printf("%d\n", match("(asdf{a[ss(|\\)asdf]})", NULL));
printf("%d\n", match("(asdf{a[}(|\\)asdf]})", NULL));
}
A variety of projects from the Elysian Shadows team and Falco Girgis that should have been open sourced a long time ago as per the Kickstarter campaign.
I like the speed of asm but I don't like variable management in it. So I want to make a language that compiles very easily into just as efficient asm. Here are some of my ideas
#Syntax similar to Python's list generation compiles beautifully into asm
list = for i in [1, 2, 3] : i * i
#list == [1, 4, 9]
#Macros that are called like functions would also be nice
macro add(a, b) : a + b
#add(1, 7) == 8
I just need a way to make macros recursive without turning them into functions. Does anyone know how to do this?
open :: Char -> Bool
open '(' = True
open '[' = True
open '{' = True
open _ = False
close :: Char -> Char -> Bool
close '(' ')' = True
close '[' ']' = True
close '{' '}' = True
close _ _ = False
check :: String -> Bool
check = go []
where
go [] [] = True
go s (o:t) | open o = go (o:s) t
go (o:s) (c:t) | close o c = go s t
go _ _ = False
Hello, i am starting to learn code and such and i decided to start by python since it seemed to be the standart newb language to first learn.
I was wondering if i am wasting my time, since i see a lot of strong opinions against this language.
Should i try to learn another language ? If yes then wich one ?
I've been coding for years and use Python whenever I can. The only reason not to use it is if you're making a game or doing system work.
I'm surprised at how many of these anime girls holding SICP images exist.
When you say asm do you mean assembly?
Python is good for starting out, but once you have the fundamentals figured out, it's good to move on.
>what is photoshop
Yes, is it ever used to mean something else?
It's not like it takes particularly long to edit them.
Python is a dogshit language for non-programmers to get basic automated tasks done. The second you need it for anything intensive or important it goes out the fucking window, and god forbid you try and write anything complex in it and need to maintain it.
It's idiosyncratic on so many levels and violates every single rule of programming language theory. Just because its popular doesnt mean its even remotely good.
Do not use python unless you have no interest in programming.
I only ask because your post would only make any sense if it meant something else.
What the fuck do you mean "a language that compiles very easily into efficient asm"? Do you even know what a compiler is? What the fuck is "macros that are called like functions" mean? Do you mean a fucking macro?
>I like the speed of asm but I don't like variable management in it
Just use C, idiot.
>I just need a way to make macros recursive without turning them into functions
Making them recursive essentially make them Turing complete, and at that point, you basically could just use an actual function.
Python is objectively terrible for starting out because it holds no real relation to any other language. Whitespace syntax, dynamic strong typing, utterly worthless function signatures, bafflingly designed list comprehension syntax, and a giant reliance on "write whatever seems right" problem solving leads to horrible, horrible misunderstandings of what anything is doing, how it works, or how to do it.
you might be mildly retarded, user
I mean I want high level Assembly. The C compiler is top of its class but I can easily outperform it in Assembly. I basically just want a language I can write Assembly faster in, something that maps to Assembly better than a typical procedural language but also isn't verbose. Kind of like Forth but even more low level.
Thx for the quick answers !
I think i will finish learning phyton for the programing basics then move on to somenthing that braches out.
What language would be recomended after phyton ?
>I can easily outperform it in Assembly
Writing garbage in C is one of the most important learning experiences a programmer can have
You should unironically shoot anyone who recommends C or C peepee.
I get that it's easy to make but it's just the sheer amount of them.
I don't even know how to respond to that.
Yes, it teaches you to not use C for most projects.