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


>replaces half of /g/
sammy boy give me that 6 trillion back
>>
>>106773811
I'm a webdev and this might replace me.
>>
>>106773811
Good. I think a significant number of devs actually want to be replaced. The problem is we're still quite far from UBI.
>>
What fucking kike retard had the brilliant idea to gut the entire American manufacturing base? Who is going to know how all the tools that make modern life possible in 50 years works? Another kike cause famine when will it end.
>>
>>106773873
It will never end. They are the biggest proof of God there is. They can be exclusively evil, hunted down in every single country they end up in and still they are preserved and rewarded over and over again. God is a monster and loves their work.
>>
>>106773811
>says c
>returns bool
>>
>>106773939
legal in c23
The context is that I was asking it a style question about
bool leapyear(int year)
{
if (year % 400 == 0)
return 1;
else if (year % 100 == 0)
return 0;
else if (year % 4 == 0)
return 1;
else
return 0;
}

bool leapyear(int year)
{
if (year % 400 == 0)
return 1;
else if (year % 100 == 0)
return 0;
else if (year % 4 == 0)
return 1;
else
return 0;
}


If the common case (mathematically AND, assumed/measured usage statistics) isn't a leap year I want that on the first level. So it reads. returns bool, leapyear, takes an integer year, if cond1, else if cond2, else if cond3, else return 0.
Or in other words, if none of the conditions the programmer considered hold this program returns 0.
Whereas on the second you just know that the program hits an else and exits, implying that you might expect the function to be used in situations wear leap year is more common than expected from random input.
>>
>>106774102
s/wear/where
>>
"I know this. It's a fizz buzz"
>>
>>106773811
if (year % 4 == 0)
.......
if (year % 400 == 0)

USE CASE SAAAAAAAAAAAR?
>>
>>106773939
Yes, C has a boolean type:
https://en.cppreference.com/w/c/header/stdbool
>>
>>106775141
>>106773939
https://en.cppreference.com/w/c/keyword/bool.html
>>
>>106773873
Why would they care? Jews are nomadic
>>
>>106775248
They ain't learning Chinese. Drew Default larps like he knows Moonrunes but still chose to escape to the Netherlands.
>>
>>106773811
I don't like this form, personally. The most common type of leap year is described only indirectly, by skipping the first conditional and being caught by the second. I think the second form that >>106774102 gave is much better, because it's closer to how a person would describe the rules for leap years in natural language.

>>106774261
It doesn't say that, though.
>>
>>106775269
Sure...don't look up history of the jews in china
>>
>>106773939
c has always had the bool macro dipshit
>>106774261
the first if statement is inverted, retard. they're nested. integers modulo 4 is a superset of integers modulo 400 so nesting (or returning early with the inverse) is correct.
>>
>>106773873
fun fact. the united states is not the first globalist country thats done this. The first country, was the british empire. Starting in the 1800s, the jewish bankers noticed industry was making goys rich, so they started outsourcing industry to east asia. Its why cities like singapore and hong kong exist. When the USA started industrializing, the british started fucking around and basically meme'd them into their civil war.

The british remained rich and powerful for the next 50 years while the usa recovered from its internal issues, like paying reparations to blacks for slavery. But then the germans started to industrialized and oops, suddenly theres world war 1 to put an end to german industrial shenanigans and then crushed them with debt and reparations. are you begining to see a pattern here?

the purpose of out sourcing is to let the rich stay rich from industrialization while specifically not letting their countrymen become rich with them because then they might become competitors.

basically, you have to expel every single one of them and forbid them from ever stepping foot in your country if you want to stop them from doing this. but they have so much money from monopolizing industrialism and banking that there will always be shabbos goy traitors who will willingly work for them.
>>
>>106775269
>They ain't learning Chinese.

they tried. the chinese unironically stabbed them in the back before the jews could stab them in the back. so now china gets to be our fake enemy along side russia.
>>
>>106773811
This code doesn't look correct...
>>
>>106775275
The real problem is that if you were going to write it like that you might as well just do
bool leapyear(int year)
{
if (year % 4 != 0)
return 0;
if (year % 100 != 0)
return 1;
if (year % 400 == 0)
return 1;
return 0;
}


I prefer
bool leapyear(int year)
{
if (year % 4)
return 0;
else if (year % 100)
return 1;
else if (year % 400 == 0)
return 1;
else
return 0;
}

Which reads as
int year
(int, divisible by 4 ) year
(int, divisible by 100 (4 and 100 equivalent) year
(int, divisible by 100, but not 400) year
(empty) year
importantly I know exactly what will happen given an input only reading 5 lines, whereas the top you need to read 8 lines including the 5 here
>>
>>106775822
at most 5 lines*, at most 8 lines*
>>
>>106774102
>>106775822
why use if statements to make it even less understandable at a glance?
bool leap_year(int year)
{
return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
}
>>
>>106775937
Now you have to read the entire program to know what any int input will produce. It's better to spread code into modules and only read it when it's relevant to your specific input/problem.
>>
>>106775975
Is this some sort of bot reply?
>>
>>106775994
Excuse me?
>>
>>106775975
you are mentally challenged by chance? a single expression can be read if multiple of 4 and not a multiple of 100, or a multiple of 400. it is far easier than the subtractive "method". also the dumbass is using else statements when the prior if block has a return statement, there by making them pointless. jeet or bait
>>
>>106776001
You're talking about splitting a 4 line function into "modules". I figured it was a bot just replying with nonsense, but apparently things are worse than I could have possibly imagined.
>>
bool is_leap_year(int year) {
if (year % 100 == 0) {
return (year & 15) == 0;
} else {
return (year & 3) == 0;
}
}


Even better. AI btfo.
>>
File: file.png (19 KB, 539x160)
19 KB
19 KB PNG
>>106773811
>meanwhile in C#
I don't even have to think about this and getting a wrong implementation since MS did all the work for me, so I can focus on the business logic and real problems
>>
File: file.png (44 KB, 616x265)
44 KB
44 KB PNG
>>106776103
and the underlying implementation
>>
>>106776105
why does 10000 throw an exception? does the work end?
>>
>>106776127
>work
world, im retarded
>>
>>106776127
all sane modern systems expect the year part of a date to be 4 digits
don't worry, it will get updated when the Y10K craze happens in ~8000 years
>>
>>106776103
>meanwhile in C#
They don't have a keyword for isLeapYear? WTF is microdick doing?
>>
>>106776005
I've programmed more APL/J/BQN than you would care to know anon. But fun and work are 2 different things.
>>
>>106776103
>≠
I hate IDEs that turn != into ≠
>>
>>106776127
>does the work end?
hopefully, yes.
>>
if (year % 504 == 0)
{
return 1;
}
else
{
return 0;
}

Check mate atheists.
>>
>>106776158
That's not the IDE, that's their font that supports ligatures.
>>
>>106776127
Real answer is leap year calculations aren't discrete. The existing algorithm is just close enough. Keep in mind the rotation of earth is slowing with each passing year as the moon's orbit fucks with it.
>>
Any trivial problem is setup to attract input from everyone, even people who barely know about said problem. So the majority of time and effort goes towards discussing the trivialities of fizz-buzz rather than designing solutions to complex engineering problems.
>>
xkcd.com/169/
Every mathematican and lisp programmer when they claim to have already solved some problem.
No, you didn't solve the problem because you never understood the problem. You did something that looked vaguely similar and poorly communicated the results.
>>
if you can't compete with a glorified magic 8ball you deserve to be replaced
>>
>>106776182
yeahhhhhh... about that anon. we're gonna need to do stay in on this one... we can't miss this deadline...
>>
>>106776399
but you're not competing with a glorified 8ball. you're competing with the hopes and expectations projected onto a glorified 8ball. by the time the results can be compared you've already been fucked.
>>
>>106776379
typically the mathematician starts by redefining the problem as something else

(we have a word for mathematicians who don't do this - physicists)
>>
>>106773811
Use case?
>>
>>106776434
implementing thumbnails
>>
>>106776408
More like you are competing with the delusional capitalist's fantasies and if they want to hoard and/or burn their money while they pray for god to come down and take them to heaven then they will while you starve.
>>
>>106776451
ai is the dream of managerialism, which is a form of bureaucratic socialism
>>
>>106776454
LOL, you think it's your manager dumping billions into a chatbot?
>>
I am Indian (Brahmin) and I need you to believe this will replace you.



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