[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Extremely Advanced Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 61
Thread images: 6
File: Goes_To_Operator.png (58 KB, 269x349) Image search: [Google]
Goes_To_Operator.png
58 KB, 269x349
So /g/, where were you when you learned about C's beautiful 'goes-to' operator? x --> 0
>>
>>51581410
There is no 'goes-to' operator, it's just
x-- > 0
. Stop spreading misinformation.
>>
>>51581447
fuck off old piece of shit, it was introduced in C99
>>
>>51581410
>He doesn't use the slides down operator
while (x -
\
\
\
\
-> 0) {
}

is the only way to go.
>>
>>51581550
nice, hadn't seen that one before
>>
>>51581410
Is this a troll or is it legit?
>>
>>51581410
>text editor colorizes every single word on screen
It's like highlighting every line of text in a textbook, if everything is highlighted, then nothing is highlighted.

Why do codemonkeys do this shit?
>>
>>51581606
Dennis Ritchie here, it's completely legit.
>>
File: 6jp3lJrSKJa91QCYTf-hHP.jpg (387 KB, 1600x1200) Image search: [Google]
6jp3lJrSKJa91QCYTf-hHP.jpg
387 KB, 1600x1200
>>51581550
>>
>>51581654
He ded. I tell you he ded.
So troll...
>>
>>51581652
There are 14 words on the screen, its not surprising most of them are highlighted because most of it is boilerplate.
>>
>>51581652
the goal of syntax highlighting is not to make some lines stand out more than others (except maybe lines with only closing braces, etc.). highlighting should mainly make it easy to spot typing and syntax errors, and give you a sense of the overall structure of the code. I can easily look at a function and see exactly where all of the loops are, where the return statements are, and so on by just looking for the keyword highlight color, and so it makes it easier to find specific locations in a file.

Also, it decomposes lines/statements in the correct way automatically. For example,
 int_struct get() {
...
}

vs.
int struct_get() {
...
}

Obviously this is an exaggerated example, but things like this happen often.
>>
>>51581652
in my colorscheme highlighted words actually have lower contrast then if they were white
I actually like this, it really gives emphasis on the parts that aren't trivially parseable via regex
>>
>>51581652
OP here, it's default vim C highlighting. I don't see the problem with differentiating each type of token by color...

>if everything is highlighted, then nothing is highlighted
that's only true if it's all in the same color dipshit
>>
>>51581550
ikek s+
>>
>>51581652
d-do you like my highlighting senpai
>>
>>51581837
>nano
>>
>>51581837
6/10
why are format specifiers in the same color as keywords?

>>51581845
>real programmers use XXX
no one cares you shit
>>
>>51581879
>why are format specifiers the same color as keywords
because terminal colors are limited
i'm just using default nano colors plus color rule for things that have a close proximity to left-parentheses, which are logically always function names.
>>
>>51581933
sure, but at least use normal (not bold/bright) yellow for the strings
>>
>>51582057
You shouldn't be using string literals very often in your code, or else you're probably just writing some trivial 100 sloc calculator.
Why aren't you complaining about preprocessor directives being the same color?
>>
>advanced programming
>dereference
>>
>>51581550
top kek thanks anon
>>
>>51581659
>Si tu vero homo
Did good old Pluto say that?
>>
Hmm, doesn't seem to work?
>>
>>51581410
>advanced
>programming
pick one

Learning programming is a side effect of learning something bigger like CompSci.

If only this board focused on the things you program for, rather than the programming itself.
>>
>>51581933
>because terminal colors are limited
Konsole + neovim supports 24bit color.
>>
>>51583336

thanks james :^)

#docksed
>>
>>51583336
You forgot to print "\n" so the output never gets flushed.
>>
>>51581606
> Is this a troll or is it legit?
See
>>51581447

Some people think it's amusing to write
> while (x-- > lim)
as
> while (x --> lim)

Both consist of exactly the same sequence of 7 tokens:
> while ( x -- > lim )
>>
G  N  U  /  L  I  N  U  X

N N

U U

/ /

L L

I I

N N

U U

X X


>>
>>51581652
>about 40% of the characters shown, serving various semantic purposes, are white
>every single word
baka desu senpai
>>
>>51583416
>KDE
>>
>>51584652
it's the only DE making progress towards things I care about

>inb4 >using a DE
>>
>>51581447
>>51584540
But then shouldn't it not print 0
>>
>>51584802
((x-- == 1 > 0) == 1 && x == 0) == 0
>>
>>51584867
== 1 rather
>>
>>51584721
KDE post 3.5.11 can go to hell.
>progress
>removing customization with every update
>muh flat bullcrap
>muh gigantic widgets bullshit
>>
>>51581410

am i the only one that hates the color contrast between the red font and the dark background?
>>
>>51584905
>removing customization with every update
like what?
>>
Does nothing.

#include <stdio.h>

int main () {

int x;
x = 0;
while (x --> 32) {
printf("--%i\n", x);
x++;
}

return 0;
}
>>
>>51584867
>>51584883
This is confusing as fuck to me, but I think what's going on is this:

x-- is postfix, so the loop condition evaluates x > 0 before doing x--. So when x == 1, 1 > 0, then x-- so x == 0 which is output. It would also explain why 10 isn't output either
>>
while (yourSon == mainAntagonist) {
switch(ending) {
case1 = killSon
case2 = nukeBoston
}
}
>>
>>51581410
>Advanced programming
>spaghetti code
Pick one. I don't care about the dark old days where this was the only goddamn way, you don't hear about people talking about astrophysics and then reference back when we first made cave art of flying things.
>>
>>51586405
is this some fucking troll
>>
>>51586405
omedetou dude
worst code i've ever seen on /g/
even worse than that faggot with the strlen implementation designed to leak memory.
>>
>>51581879
nano actually does just suck though, especially when there's tons of better alternatives out there
>>
>>51587373
Such as???
What features are you sorely lacking in nano?
>>
>>51587740
Any easy way to navigate around my code besides the arrow keys
>>
>>51587978
pgup/pgdn/home/end
>>
>>51588011
Doesn't exactly add much. vim and emacs have 10 times more shit than nano does
>>
>>51588072
vim and emacs also take 10 times longer to learn
>>
>>51588122
Worth it in the end though.
Hell, you could just use Sublime Text
>>
>>51588128
or i could just use nano
>>
>>51588122
it takes a few seconds to learn the commands you need to get the same functionality as in nano. the difference is that if you want to learn more, vim has it.
>>
>>51588147
what if I don't want to spend hours and hours ricing my text editor?
>>
#include <stdio.h>

int main(void)
{
printf("%d\n", 10
/\
*your text editor's syntax coloring can't handle this *\
//5);
}
>>
>>51588146
Enjoy your shitty editor then
>>
Stop hating on nano. It's a good text editor.
>>
>>51588201
enjoy writing toy programs and never getting anything done
>>
>>51588214
I'm not the one eating shit and trying to convince myself it's not shit
Thread replies: 61
Thread images: 6

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.