[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

[Advertise on 4chan]


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: some code Idk lmao.png (58 KB, 1280x720)
58 KB
58 KB PNG
What are you working on, /g/?

Previously: >>85205529
>>
File: pts_build2.png (4 KB, 264x264)
4 KB
4 KB PNG
>>85227271
Daily reminder to anons to ignore the cnile I mean cmake post and use build2 instead.
>>
File: 1641163902282.jpg (9 KB, 174x290)
9 KB
9 KB JPG
> https://dingdingsherrywang.medium.com/system-design-instagram-4658eeb0423a

i am mugging up Sys design for an interview next week. in the api section:

> create_post(user_id, image, text, timestamp) -> success/failure

i dont understand why we have timestamp as the input to the function. wouldnt the timestamp be generated automatically inside the function whenever user uploads?
>>
>>85227342
That would make the post time dependent on when the create_post function is called, and the time it takes to run.
>>
File: screen-0.png (193 KB, 1278x979)
193 KB
193 KB PNG
>>85227271
ColorForth for arm thumb, had it working for the NDS but got fed up with emulators n shiet.
In retrospect this is better and much much easier
>>
>>85227271
I just fixed a bug in my multi-threading class and made it work with container types as well as primitive types. It is SFINAE now.
>>
>>85227271
Trying to decide between learning Haskell or F shart. Hask has more meme power but F interops with my beloved C shart.
>>
File: unnamed.jpg (319 KB, 900x900)
319 KB
319 KB JPG
>>85227401
Microsoft uber alles
>>
https://www.cppstories.com/2021/concepts-intro/
>>
>>85227342
>>> create_post(user_id, image, text, timestamp) -> success/failure
If the user cannot correctly guess their timestamp, they don't get to post. I'd say a 50ns discrepancy is more than generous.
>>
File: 1593835886758.jpg (120 KB, 972x972)
120 KB
120 KB JPG
>>85227271
how hard would it be to contribute to the GCC's C frontend? I'm thinking simple stuff like adding some warnings which exists on clang but not on gcc.
>>
are you guys using maui?
>>
>>85227438
C# maui?
was interested in it a while ago but it seems it's only made for webapps in mind not so much desktop.
>>
>>85227475
yes
I really like c#, but I would like a crossplatform gui lib with good styling options (something like javafx).
I've tried the latest maui but I have some problems running it outside of visual studio.
>>
>>85227508
There was this other library called Avalonia. I played with it for a while, very similar to maui except it's not as official of course.
>>
>>85227508
I wonder if you could use maui as an interface for a cpp backend? I never tried to make anything with dotnet core before let alone to connect it with c++ backend but that would be really nice since I won't have to write the UI in c++.
>>
>>85227432
do it and report back.
>>
Hey guys I'm new to Java, our first assignment is to make a user input questionnaire, and then output it as a form. My code is messing up though.
The input questions switch from string (name), to integer(date of birth), back to string. But when it switches back to string it prints two questions at once ignoring the input of the first one.

When I reorder the questions, all the strings at the top, it fixes the issue... Is there a way around this?

Assignment 1 is to make a vaccination form, pretty cringy imo
>>
>>85227557
I have literally done this more than once anon.
Best way is to write a DLL API that calls your C++ classes and stuff. The problem is that you have to export a C library interface, which means a collection of functions.

So you DLLimport the functions in C# and write a wrapper class around it. If you pass back and forth a lot of data, it could be cumbersome. Otherwise it's manageable.
>>
File: 1601755929799.jpg (272 KB, 1440x1440)
272 KB
272 KB JPG
when do I stop zoning out and snapping back to reality thinking I have to get ready for the next AoC puzzle dropping?
it is still happening a month later
>>
>>85227582
How's the maui performance though?
>>
>>85227557
looks something like this:
        [DllImport("MyDll.dll")]
public static extern void InitLib(int one, int two, int three);

and the C API:
extern "C" 
{
__declspec(dllexport) inline void InitLib(int one, int two, int three)
{
//Call C++ code here, pass along data.
}
}


>>85227611
I don't know what maui is.
>>
>>85227582
>>85227623
sweet. thanks.
>>
>>85227578
Not a java whiz, but my guess is this: the scanner buffers input from stdin, then reads the buffer until some criteria is fulfilled. Later bytes stay in the buffer. "nextInt" and "nextLine" specify criteria; nextInt reads until a valid int is read, nextLine reads until the next linebreak. Importantly, nextInt doesn't remove the linebreak after the integer from the buffer. So the lf is still there to be read by nextLine. nextInt will remove linesbreaks from the buffer until it finds a valid int. The fix is to put a "readLine" call after you read an int before you need to read a line. This will clear the linebreak from the buffer.
>>
Posted in the last thread for the image-to-ascii guy, but I did something similar several years ago. I suggest mapping the character choice to HSL's lightness value rather than avg of RGB values. It's probably more accurate.
>>
>>85227750
Ya I found the answer online thankfully, I just had to put one line of code between them: in.nextLine();
Thanks for your help!
>>
I was reading further on designing instagram and it seems they have an auto incrementing number ( +1, +2 .. ) that forms the photo id internally in their db. How do they deal with overflow??
>>
>>85227897
are you kidding
use a bigger integer
dumb fucking frogposter
>>
>>85227594
what's aoc?
>>
>>85227911
even bigger ints ( long int ) will overflow so i am confused
>>
>>85227950
https://adventofcode.com/
>>
>>85227301
>>85227228
I know it isn't perfect but it works.
>>
>>85227963
It overflows at 18446744073709551615.
Is this limit a concern?
>>
>>85227968
looks like homework
>>
>>85227766
HSL is pretty naive, I think the L value is the same as the average of the RGB channels. Maybe you're thinking of CIE LAB?
>>
>>85227271
>std.stdio
Something's wrong. I can feel it.
>>
>>85228185
D is wrong. it should be std.io
>>
>>85228131
L is
cMax + cMin / 2.0
, but there are probably better ways to get a lightness value, or better approximate the brightness. It also helps if your char set is aligned correctly.
>>
I have no idea what this is asking me to do. I understand that a * b^n is supposed to remain the same in the iterative function but I don't understand what the goal actually is
>>
>>85228896
Implement a formula for a^x that is logarithmic in time complexity (unlike the naive a * a * ... * a, which is linear).
>>
>>85227271
I'm pretty happy. I've been messing around with the Irrlicht engine, trying to get a flight sim working because I'm angry about all existing flight sims, and I just got some functions I wanted working after struggle.
Matrix math was never my strong point, but I'm picking it up now given how vitally necessary it is for rotating anything.
>>
>>85227996
For reference, this means everyone person on earth could have ~2.3 billion photos before it overflowed. If you uploaded a picture every second, it would take you 73 years to have created that many photos. It's plenty big.
>>
>>85228954
I'm not doubting that there is importance to this but I'm just curious what knowledge of this will enable in the future? I am going to need to spend some time absorbing this (or looking up an online lecture that might explain it a little less densely)
>>
>>85228998
It should show you that things can be implemented using different formulas with drastic effects on performance. It can also be seen as an introduction to dynamic programming.
>>
>>85228995
What does it do that is different from a normal bitcoin wallet?
>>
>>85228995
bitcoin will never succeed as a currency. even if it was about to, it would be rug pulled instantly by every functioning government. the fact that it exists should indicate the extent they view it as a threat.
that isn't to say crypto isn't really big, but you should be looking at who the market actually is: gambling, e-celeb worshipping cryptobros. build something to appeal to them, because no enterprise wants to accept your credit card, and one wants to use one.
>>
>>85227897
they probably use something like the C# Decimal class or some other "big int" implementation, as long as they can store it in memory as an array it will be ok. Then again.. It's probably a fucking database value, right? So see what types a SQL database has available.
>>
>>85229016
It is like a credit card that accepts the bitcoin as a form of payment.
>>85229057
Legally this is a method of payment, not an actual currency.
>>
>>85227578
>Is there a way around this?
Use the Console class. (You have to do some validation work anyway.)
>>
>>85229102
I was able to fix it, now I'm trying to set limits to the user input, is there a way I can set the integer input to only accept 1 to 31 for the day input? 1-12 for month, etc
>>
>>85229227
int day = -1;
while (true) {
day = scanner.nextInt();
if (day < 1 || day > 31) {
System.out.println("Day must be between 1 and 31");
} else {
break;
}
}

This is a very naive implementation which does not account for months of variable length, you can figure that bit out, but it demonstrates the basic idea. What is it exactly that you are studying?
>>
>>85229525
It's an intro to java object orientated programming class. And thanks for your help, it's really appreciated.
Btw is there a way I can limit the "first name" input to only accept strings with the first letter capitalized?
I'm not sure if he wants the code to automatically capitalize the input after its entered, I think that makes more sense, and would be easier.
>>
File: 1639685294412.jpg (2.56 MB, 2500x1667)
2.56 MB
2.56 MB JPG
frens, i had a question on the db schema

> https://stackoverflow.com/questions/39810106/storing-messages-of-different-chats-in-a-single-database-table

> Now, to load messages for any given user, you can simply join Group_User_X and Message table and fetch messages for the groups in which the user belong

how would a join for a particular user look like? because for joining two large tables seems very inefficient just to get messages for one user. Do we create an index on userID so that it sorted ( to find user quickly ) and then go from there?
>>
>software engie
>want to get a job as ML engie
>have to write articles like a fucking pleb so i can show i know something about ML

I love writing but I hate writing fucking technical articles
>>
>>85230062
>I love writing
fucking gay
also ML isn't real engineering
>>
>>85230077
Software engineering isn't real engineering, either. DevOps, maybe
ML is what I'm more passionate about though
>>
File: windowschantp.png (313 KB, 398x602)
313 KB
313 KB PNG
>>85230134
it's more like architecting imo
>>
>>85229712

Separate tables of {UserId (index), GroupId} ; {message, GroupId (index)}

Doing the join shouldn't be too bad, and if still concerned about performance you could cache the GroupId's client-side to avoid joining on every single refresh.
>>
>>85227432
They should probably have an IRC with greybeards to ask
>>
What does
some_unsigned_val = -some_unsigned_val

do in C?
>>
>>85230626
anon@localhost:~$ ./a.out 
20 e0
anon@localhost:~$ cat a.c
#include <stdio.h>


int main()

{
unsigned char x = 32;
unsigned char y = -x;
printf("%x %x\n", x, y);
return 0;
}

>>
>>85230626
deletes your computer
do NOT do this
>>
>>85230626
probably meows the highest order bit into the unsigned giving you a corrupted very large value

though that would likely be platform dependent behavior, perhaps it is undefined behavior
>>
File: raycasting.webm (1.64 MB, 960x720)
1.64 MB
1.64 MB WEBM
Made this using Python with numba & PIL. Are there efficient ways of creating the floor grid?
This function gives you the positions of the grid pixels for every line of the screen, which is 320 pixels wide:
@jit(nopython=True, fastmath=True, parallel=True)
def compute_floor(size, fov, step, maximal, pl_angle, pl_x, pl_y, map):
sx, sy = size
out = List()
th = 0.1

for n in range(0,sx,1):
buffer = List([0])
angle = radians(fov*(n/sx-0.5)+pl_angle)
dist = 0
for dist2 in prange((int(maximal)+1)*10):
dist = dist2/10
x, y = cos(angle)*dist+pl_x, sin(angle)*dist+pl_y
if fabs(x%1-0.5)<th or fabs(y%1-0.5)<th:
distance = dist*( cos(radians((n-sx/2)/sx*fov)) + 1/1000 )
h = round(sy/(distance+1/1000)/2)
buffer.append(h)
else:
pass#buffer.append(0)
if map[round(y)][round(x)]!=0:
while map[round(y)][round(x)]!=0:
dist-=step/10
x, y = cos(angle)*dist+pl_x, sin(angle)*dist+pl_y
dist+=step/10
x, y = cos(angle)*dist+pl_x, sin(angle)*dist+pl_y
texture = map[round(y)][round(x)]
break
dist+=step
distance = dist*( cos(radians((n-sx/2)/sx*fov)) + 1/1000 )
h = round(sy/(distance+1/1000))
for _ in range(1[spoiler][/spoiler]):
out.append(buffer)
return out
>>
>>85230714
do us a favor and start commenting out what you're doing like
#computes the floor tile somehow using these inputs
def compute_floor ...
#...
#loop to do god knows what
>>
What is the difference between async\await and thread\join?
I'm legitimately curious, isn't async just creates a thread and await joins it?
>>
>>85227286
why
>>
>>85227286
>boys love 2
What a name for a build system
>>
Bad.

int function()
{

struct A a;
struct B b;
struct C c;

if (!initialize_A(&a))
{
return 0;
}

if (!initialize_B(&b))
{
destroy_A(&a);
return 0;
}

if (!initialize_C(&c))
{
destroy_B(&b);
destroy_A(&a);
return 0;
}

// Do stuff

destroy_C(&c);
destroy_B(&b);
destroy_A(&a);

return 1;
}



Good.

int function()
{
int ret;

struct A a;
struct B b;
struct C c;

ret = initialize_A(&a);
if (ret)
{
ret = initialize_B(&b);
if (ret)
{
ret = initialize_C(&c);
if (ret) {

// Do stuff

destroy_C(&c);
}
destroy_B(&b);
}
destroy_A(&a);
}

return ret;
}
>>
File: ss.png (120 KB, 2088x1187)
120 KB
120 KB PNG
>>85231026
Alright, here:
https://pastebin.com/Ja714eZb
>>
>>85231142
Best
void function()
{
struct A a;
struct B b;
struct C c;

if (initialize_A(&a))
goto exit_a;
if (initialize_B(&b))
goto exit_b;
if (initialize_C(&c))
goto exit_c;

// do stuff

exit_c:
destroy_C(&c);
exit_b:
destroy_B(&b);
exit_a:
destroy_A(&a);
}
>>
>>85231172
This use to be my method. But after having to add more error recovery code, I feel into the pattern of >>85231142.
>>
>>85231142
Just use C++.
>>
>>85227271
I'm inventing a LISP programming language (Scheme)

Except I am making some cool changes:
1. Mathematical style infix syntax instead of an abundance of parentheses.
2. Object-oriented subsystem inspired by EcmaScript
3. Pseudo-JIT compiler (every function is compiled after it's been encountered, rather than waiting to do Hot Loops)
>>
>>85231226
Instead of posting this everyday, why don't you post some example code?
>>
>>85231226
oh boy, another half-baked lisp flavor with dumb ideas and no actual use-case for building it
>>
>>85231226
>2. Object-oriented subsystem inspired by EcmaScript

LISPs would be more usable if they had a module system like this.
>>
-- cabal repl --build-depends transformers --build-depends kan-extensions
import Control.Monad.Codensity (Codensity(..))
import Control.Monad.Trans.Maybe (MaybeT(..))
import Control.Monad (guard)
import Control.Monad.Trans (MonadTrans(lift))

type S = Codensity (MaybeT IO)

acquire :: IO (Maybe a) -> (a -> IO ()) -> S a
acquire init fin = do
a <- lift (MaybeT init)
Codensity (\x -> MaybeT (runMaybeT (x a) >>= (<$ fin a)))

run :: S a -> IO (Maybe a)
run x = runMaybeT (runCodensity x pure)

--

data A = A deriving (Show)
data B = B deriving (Show)
data C = C deriving (Show)

acquire'A :: S A
acquire'B :: S B
acquire'C :: S C

checked :: Char -> S ()
checked c = acquire init dest where
init = do
c' <- getChar
traverse (\_ -> putStrLn (c : " acquired")) (guard (c == c'))
dest _ = putStrLn (c : " destroyed")

(acquire'A, acquire'B, acquire'C) = (A <$ checked 'A', B <$ checked 'B', C <$ checked 'C')

main = () <$ run (do
A <- acquire'A
B <- acquire'B
C <- acquire'C
pure ())
>>
>>85231401
ghci> main
ABD
A acquired
B acquired
B destroyed
A destroyed

(C failed)
>>
anyone managed to compile glsl-language-server on windows?
>>
>>85231055
async/await is a way to make asynchronous programming closer to the synchronous one, instead of eg. using callbacks
They're for fundamentally different purposes. Threads are for running code in parallel, async/await is for structuring code concurrently.

If you idk are finding the sum of all primes under X, you can parallelize that task by dividing the numbers you have to check into chunks and giving each chunk to a thread.
If you're waiting for a file to be loaded from the disk or a network response, you can't. If you run on a 64 core threadripper and each core runs a thread requesting something from the net it is not going to make the switches and wires in the internet any faster.
>>
>>85227271
How do you learn to code?
I'm trying to learn python. But it doesn't feel like programming. it feels like importing libraries and doing stuff with them. But I still struggle to do a while or for loop, and maybe I'm wrong but that seems to me like a basic skill when writing code.
>>
>>85231730
Stitching together libraries is what python is for.
>>
>>85231633
>Threads are for running code in parallel
Except threads run the code concurrently.

You're confusing threads with multiprocessing.
>>
File: fuckyou.gif (2.95 MB, 320x567)
2.95 MB
2.95 MB GIF
>>85231793
>this kind of retarded nigger monkeys post here
>>
>>85231749
but then, my question stands, that's not programming, you aren't learning how to structure stuff and solve problems. how to make code out of problems. I don't know how to put it.
and as I said, the fact that I still strugglin with every for loop makes me think I'm not going in the right direction
>>
>>85230134
>Software engineering isn't real engineering
How to say I never created a software with saying I never created a software.
>>
File: 1626729078907.jpg (40 KB, 524x228)
40 KB
40 KB JPG
>>85232056
you will never be an engineer.
>>
>>85231793
lol, is this bait?
>>
>>85231995
You can write complicated stuff in pure python. It'll just be slow and the lack of static typing means you need have to debug run time errors more.
>>
>>85227271
avx-512 glza decoder for my corporate overlords
need that promotion so i can retire before 30
>>
who dsp here?
>>
>>85231793
what?
>>
>>85227271
Based D poster.
>>
File: 1636920379802.jpg (287 KB, 2048x1609)
287 KB
287 KB JPG
when will trying to make things stop making me feel like a retard?
>>
>>85232106
>you will never be an engineer.
You're technically right, I'm struggling in CE.
>>
>>85232132
Go to /sci/
>>85232215
Learn how to do things right.
>>
>>85232132
audio stuff is interesting.
wish /dpt/ had more people posting their projects
>>
Best to learn C++ if no interest in web development?
>>
>>85232329
yes
>>
>>85232116
is the answer to unironically switch to another language? learn algorithms or pseudocode?
I'm not even trying to code for a wage, I'm too old for that, but I don't want to waste time learning wrong
>>
>>85232391
Well, python is a very practical skill to have. If you keep practicing with it, you will get better over time, even if you don't feel like you are. But working on completely self contained projects are good too. You could start with C, and get up to chapter 3 in K&R.

https://kremlin.cc/k&r.pdf
>>
>>85231055
You already seem familiar with threads, so I advise you read this to get a better understanding of asynchronous programming:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/task-asynchronous-programming-model#BKMK_WhatHappensUnderstandinganAsyncMethod

When you call or await an async function, no thread is created. Instead, when you await a task in an asynchronous function, the control is yielded back to the caller if the task result isn't available yet. All of this is single-threaded.

The main use for asynchronous programming is to abstract away callback-based task management. This way, the scheduling and sequencing process is seamless and handled intrinsically by the language rather than by implementing your own task scheduler, which is a very tedious process.
>>
>>85232329
Funny way of spelling Haskell
>>
>>85232329
Rust is better.
>>
File: 1641658506018.jpg (53 KB, 660x716)
53 KB
53 KB JPG
>>85227271
some time ago a lead programmer in my workplace commented me that they need a lot of programmers. I asked what specifically they're searching for and said that python is highly demanded. I don't mean it as my workplace needs it but in general, the work market. I learnt some c++ and html in high school and uni but desu I've come to forget all that.
Is it worth learning python? what can i do with it personally and professionally? I want to change careers and get into informatics or computing. Dunno desu. What will you all recommend me?
>>
>>85232664
Better at what?
>>
>>85231730
>>85232391
If you don't understand loops, I advise you immediately drop whatever you're trying to work on and go back to the drawing board by picking up an introduction book.
You will do most of your programming-related learning "on the field" by working on projects and reading source code, but trying to write code when you don't understand the most basic and fundamental concepts is straight-up shooting yourself in the foot. It's like trying to learn Russian without knowing cyrillic.
As the other anon pointed out, K&R is good and not that hard but it will not hold you by the hand.
>>
>>85232722
widening and narrowing a stinky hole with no problematic implicit conversions, (C)hud.
>>
>>85232702
python can quickly get work done and that's generally more important than micro improvements
>>
>>85232762
You might need some help
>>
>>85232836
rust community is full of help the you want, but not the help you need.
>>
>>85231618
Answering myself: it wasn't even much of a problem. Just add
if(WIN32 AND MINGW) # fix issues with mongoose
target_link_libraries(mongoose ws2_32 wsock32)
target_compile_options(glslls PUBLIC # http-server flags
-DMG_ENABLE_IPV6=1 -DMG_ENABLE_LINES=1 -D_POSIX_C_SOURCE=200000L)
endif(WIN32 AND MINGW)

to CMakeLists.txt right before darwing conditional check. Then boom - it compiles.
I'll need to see if the program itself works.
>>
>it's a c/++ repo with no CI badges and a currently failing master branch
ah yes, and a major group like LunarG at that. truly quality stuff
>>
>>85232987
>CI badges
what do those do?
>>
>>85233167
let you know easily, if a current master is actually building and passing whatever tests are setup.
>>
>>85233196
>passing whatever tests are setup.
tests considered harmful
>>
>>85227271
in haskell this is just
import Data.Bool
import System.IO
import Control.Monad

fetch acc = bool (fetch . (acc <>) . pure =<< getLine) (pure acc) =<< isEOF

main = print . ap ((/) . sum . map (fromIntegral . length)) (fromIntegral . length) =<< fetch mempty
>>
>>85233220
more chars
very embarrassing showing
>>
>>85233167
in a readme, you can put links to continuous integration services which will have an svg with the current build status of a branch showing passing/failing. other common uses for badges are as links to package repos or documentation.
>>
>>85227271
in sh this is just
wc | { read -r l _ c; echo $((c/l)); }
>>
File: blip.png (95 KB, 1127x580)
95 KB
95 KB PNG
>>85232132
audio dsp about old soundchip farts
>>
>>85231142
must suck not having constructors and destructors anon
>>
>>85227897
Isn't the Intstagram backend Python? It will just convert to bigint automatically when it gets too big.
>>
>>85231142
better
void fn()
{
struct A *a = 0;
struct B *b = 0;
struct C *c = 0;
if(a_init(a))
goto err;
if(b_init(b))
goto err;
if(c_init(c))
goto err;
// do stuff
err:
if(a)
a_destroy(a);
if(b)
b_destroy(b);
if(c)
c_destroy(c);
}
>>
>>85233525
If you want to go full Cnile, at least do it right.
void fn()
{
struct A *a = 0;
struct B *b = 0;
struct C *c = 0;
if(a_init(a))
goto errA;
if(b_init(b))
goto errB;
if(c_init(c))
goto errC;
// do stuff
errC:
c_destroy(c);
errB:
b_destroy(b);
errA:
a_destroy(a);
}
>>
File: ko.jpg (98 KB, 880x495)
98 KB
98 KB JPG
>>85227271
I created a rust temperature converter, though I had a weird problem with the rust compiler. It gives priority to println! over input but doesn't do the same for print!..
 print!("something"); // this later
input functions //this first
print!("something"); // this first
input functions //this later

is it trolling me ?
>>
>>85233621
not rustranny but sounds like print! simply doesn't flush output buffer before listening to input
>>
>>85233621
final, I'm a meme computer engineer.
//temperatures converting functions
use std::io;

fn celsius_to_other_units(c:f64){
let f:f64 = (c*1.8)+32.0; //to fahrenheit
let k:f64 = c + 273.15; //to kelvien
let r:f64 = c * 1.8 + 491.67; //to rankine
print!("fahrenheit: {}\nkelvien: {}\nrankine: {}",f,k,r);
}

fn kelvin_to_other_units(k:f64){
let c:f64 = k - 273.15; //to celsius
let f:f64 = (k-273.15)*1.8+32.0; //to fahrenheit
let r:f64 = k * 1.8; //to rankine
print!("fahrenheit: {}\ncelsius: {}\nrankine: {}",f,c,r);
}

fn fahrenheit_to_other_units(f:f64){
let k:f64 = (f-32.0)*0.5+273.15; //to kelvien
let c:f64 = ((f-32.0)*5.0)/9.0; //to celsius
let r:f64 = f + 459.67; //to rankine
print!("kelvien: {}\ncelsius: {}\nrankine: {}",k,c,r);
}

fn rankine_to_other_units(r:f64){
let f:f64 = r - 459.67; //to fahrenheit
let k:f64 = r / 1.8; //to kelvien
let c:f64 = (r - 491.67) / 1.8; //to celsius
print!("fahrenheit: {}\nkelvien: {}\ncelsius: {}",f,k,c);
}
pub fn temperatures_converter(){
println!("1-fahrenheit to other units\n2-celsius to other units
3-kelvin to other units\n4-rankine to other units");

let mut choice =String::new();
println!("enter the choice: ");
std::io::stdin().read_line(&mut choice).expect("Failed");
let c:u32 = choice.trim().parse::<u32>().unwrap();

let mut degree =String::new();
println!("enter the degree: ");
io::stdin().read_line(&mut degree).expect("Failed");
let d:f64 = degree.trim().parse::<f64>().unwrap();

match c{
1=>fahrenheit_to_other_units(d),
2=>celsius_to_other_units(d),
3=>kelvin_to_other_units(d),
4=>rankine_to_other_units(d),
_=>println!("wrong choice")
}
}
>>
>>85233649
kind of cool, though in truth I'm not convinced rust will be worth learning. It's not that Rust is particularly bad, though it does need a massive standard library to compete--but that other languages are improving so quickly. I can't wait to see what C++23 brings. The last program I wrote in C++ before like november of last year was back in ~2012 or so and the language has improved dramatically.
>>
>>85233514
The database is probably sql, and the column is probably a fixed size. So it would get truncated/cause an error when it was stored in the db.
>>
>>85233621
>I created a rust temperature converter, though I had a weird problem with the rust compiler. It gives priority to println! over input but doesn't do the same for print!..
That's not a problem with the compiler or the language. That has to do with flushing stdout which happens in most terminals due to println ending with \n.
>>
>>85233649
>std::io::stdin().read_line(&mut choice).expect("Failed");
kek how do you read a single char in rust?
>>
Reminding anons to use https://github.com/friendlyanon/cmake-init when creating new C++ and C projects!
>>
So I have a function template that builds a vector of random data and returns it. Should I make this work with any container type, including ones with non-default allocators? Or even custom container types?

I think the easiest way to do that would be by passing the container into the function by reference. It would also greatly simplify avoiding allocations if the user already has a container with a bunch of memory allocated in it.
>>
>>85233899
take an output range
>>
>>85232980
nvm it can't do anything
seems it'll be done the old way
>>
>>85232460
>>85232754
I'm following a python course, so I might end it and then go to learn basic stuff in C.
this might help me build a more solid foundation.
>>
>>85233867
by taking the first char from the buffer provided to read_line, so the first char from choice.
>>
>>85233928
I would rather not require it to already have the space allocated.
>>
>>85233928
particularly, because the number of elements put into it is randomized...
>>
does anyone have any tips on building iterative functions? Recursive functions make more sense to me
>>
>>85234205
is your brain rotted by functional programming or something?
>>
>>85234189
in that case you could take just a single output iterator and have the user pass a back_inserter.
>>
>>85234210
I'm learning and never have used lisp style shit before
>>
>>85227271
how is file/information transfer realized when I connect to a local server running on the same machine? Want to implement a cross platform fractal render with offline rendering where the server just renders and the client offers input stuff and wondering how large input latency would be.
>>
>>85231730
Learn assembly first. Then move up to C/C++. They actually feel like you are programming hardware without a million layers of abstraction
>>
>>85232056
I've been doing it professionally for like six years and was enrolled in an engineering degree before I switched to CS
Architect is a better word for it, but everyone says engineer so I say engie too
>>
what's rdmd?
>>
>>85234376
wrapper for dmd to test things a little quicker
>>
>>85234376
>>85234384
whoops
https://dlang.org/rdmd.html
>>
>>85234311
I understand this take, in fact I'm the kind of guy who would follow this path, but I didn't do it because I see it was a mistake.
you know, normally I would go to the basics, the very basics, I would learn electronics so I could go up from there. That maybe would make me a solid programmer.
meanwhile some kid with an 1 hour youtube tutorial on python would be writting scripts and doing stuff.
I have to find some middle place. I want to understand what I'm doing and will work on mistakes but I can't spend many time on basics.
it seems like as the programming world became professionalized, coding also became easier, because now is more about gettin shit done than doing things properly.
so we have a lot of shitty code running and many programmers who don't know shit.
but again. I'm an oldfag and I don't know anything so I should stfu
>>
>>85232056
he's absolutely right. software "engineering" isn't actually engineering. there's no scientific principles used, it's all gay management shit
>>
>>85234110
>first char from the buffer provided to read_line
That's not reading a single char isn't it?
>>
>>85234692
a char in rust has a specific meaning, it's a 4 byte Unicode scalar value.

you can use the std::io::Read trait and read a byte from stdin which implements Read.
https://doc.rust-lang.org/stable/std/io/trait.Read.html#tymethod.read
https://doc.rust-lang.org/stable/std/io/fn.stdin.html
the code will look something like this for a single character.
use std::io::{stdin, Read};
fn main() {
let mut ch = [0];
stdin().read(&mut ch).expect("failed to read");
}
>>
>>85234417
you are supposed to start at the other end, with web-dev then work your way down the complexity stack
>>
>>85234794
I don't find any logical sense to this
>>
>>85234827
that's fine, you don't need to in order to get shit done.
>>
>>85234827
If you start with the good stuff you won't be able to look at webdev without barfing.
>>
>>85233701
Well my first lang was C++ but I got filtered by it, I feel embarrassedabout that.... now I decided to shift all my mental power to Rust; it's easier to learn and practice (though user input functions are annoying compare to std::cin), my second choice will be C#, not sure if I'll retry C++; I'm afraid that I'll get filtered again.

>it does need a massive standard library to compete
It really does, networking, web and embeddeds are the only field where Rust display some superiority.
>>
>>85234213
is that really better than using:
void SomeFunc( std::ranges::range auto &containerType )
{
//use elements of a container, where available
}

which is what I ended up doing, because C++20 and it's just a personal project.

how could I make it look more professional anon? Would making the user create a back inserter actually be better than that?
>>
>>85227381
i read somewhere that there were 'forth chips'
and those chips had forth instructions on the chip.
>>
>Spend time figuring out out to do something
>Figure it out
>Someone looks at my code at points out that the language has a built in command for that thing
God damn it.
>>
>>85234890
also true, it is so fucking hard for me to learn webdev after years of C++, assembly, C#, C, etc.

>>85235026
well luckily there are several people on here that know how to use C++ incredibly well
https://www.youtube.com/watch?v=jkfwmaKIph8
>>
File: frog.png (180 KB, 986x544)
180 KB
180 KB PNG
>>85232132
>>85233276
baby level stuff. Try IDing frogs automatically
>>
File: frogo.png (12 KB, 1563x369)
12 KB
12 KB PNG
>>85235155
>yes I do my signal processing in R, how did you know?
>>
>>85235026
>Well my first lang was C++ but I got filtered by it, I feel embarrassedabout that
Almost all languages are easier than C++
>>
File: espectrograma_objetos.png (47 KB, 1192x106)
47 KB
47 KB PNG
>>85235170
>use image segmenting algorithms
>to segment audio (frog calls
I felt really big brained when I made this
>>
>>85235181
>>
>>85235026
rust enabled me to finish a lot of projects that i could never wrap up in python or c++ because there were always weird edge cases in the code base. i find it a lot easier to finish projects due to the compiler and cargo. organizing a project, pulling in dependencies, and adding tests or benchmarks are very easy to do compared to c++. that's in addition to swaths of bugs not being possible due to the nature of the borrow checker and apis. it'll probably be easier to go back to c++ after learning rust but at the same time you might dread how much more you have to keep track of mentally instead of offloading to the compiler. modern c++ still has large chunks of knowledge you have to know and keep up on to make sure the code you're writing is correct which isn't easy.
>>
>>85235194
it really rustles my jimmies to google anything about machine learning. The results I find are either very complicated papers, "complicated" papers that are made easy using some library (basically some dude learned how to use python to use torch) or literally 1000s of almost identical tutorials on medium or some random "bootcamp" website about using CNNs or RNNs to do whatever. For audio it was worse, because the problems are harder and the field is smaller.
>>
>>85232106
My diploma and job title earning 6 figures says otherwise, cope harder plumber
>>
>>85235172
>>85235172
>>
>>85227381
'colorforth'
https://www.youtube.com/watch?v=0PclgBd6_Zs
>>
File: learn-c-in-one-video.jpg (39 KB, 720x570)
39 KB
39 KB JPG
>>85235215
>organizing a project
>adding tests or benchmarks
>problem with bugs in C++
uhh are you not using Visual Studio or something?
Also what language standard was that? Did you use pointers or something?
>>
>>85233701
C++23 isn't shaping up to be much. There's a lack of confidence in the committee and a lot of places are giving up on the language because the committee doesn't want to break ABI. ISO bullshit, closed door meetings, not adapting to online development, and spending years on papers that don't have a clear path to being approved for the language means a lot of people are done trying to improve the language or libraries.
>>
>>85235181
ok what is making this superior to the filterbank method?
(never used r, c++ and julia occasionally matlab)
>>
>>85235321
1: You can't learn C++.
If you think that you learned C++, visit
https://cppquiz.org
and goto 1.
>>
File: python_cplusplus.jpg (62 KB, 700x494)
62 KB
62 KB JPG
>>85235351
I seriously doubt that. Too many corporate users to just let it die. But, time will tell. In the meantime, I guess people can go through all the growing pains of a language intended to fix one single problem with C++ that was fixed years ago (R*st)?
>>
File: 1636711832768.jpg (452 KB, 1200x931)
452 KB
452 KB JPG
>>85235098
>well luckily there are several people on here that know how to use C++ incredibly well
Oh my thanks, sure I'll give C++ another chance but after I'm done with Rust.
>>
x
>>
>>85235371
Yes C++ is incredibly complex, but that means the code you write with it just gets better and better and better the more you learn about the language. Is that a bad thing? It certainly keeps it fun. Is that any different to another language? Should the language really be that simple in the first place? There is a reason new projects from corporate users don't use C anymore.
>>
>>85235321
>>85235347
>>85235371
>>85235384
>>85235391
What's the problem with C++, what does it so difficult?
I'm talking about these replies, I don't know a thing about C++
>>
Arm Assembly > C & C++ > Write malware for IOT lightbulbs so they flash on and off and it looks like a fucking disco from ISS.

Is this a good career path?
>>
>>85235215
Pretty much this, Rust make programming easier.
>>
File: 1559080370383.jpg (81 KB, 640x480)
81 KB
81 KB JPG
>>85235439
Rinse and repeat for C++20 and C++23
>>
File: WIP.png (143 KB, 700x494)
143 KB
143 KB PNG
>>85235384
hold up
>>
>>85235026
>>85235371
>>85235427
>>85235172
>>85235321
C++'s difficulty really depends on how it's written. If you go it c-style, it isn't that much to comprehend.
>>
File: final.png (121 KB, 361x494)
121 KB
121 KB PNG
>>85235496
>>85235384
and done
>>
>>85235510
there are far too many great features in C++20 to write C-tier C++ code anon, by the 2023 standard it will probably be better than Rust ever will be imo, provided it isn't already because of template metaprogramming and concepts
>>
>>85235371
what does the "mutable" keyword do here?
#include <iostream>
#include <utility>

struct X {
X() { std::cout << "1"; }
X(X &) { std::cout << "2"; }
X(const X &) { std::cout << "3"; }
X(X &&) { std::cout << "4"; }
~X() { std::cout << "5"; }
};

struct Y {
mutable X x;
Y() = default;
Y(const Y &) = default;
};

int main() {
Y y1;
Y y2 = std::move(y1);
}
>>
>>85235351
>not adapting to online development
For me it's this one. I would have 0 reservations about C++ if they could ship a standard dependency resolution tool, and preferably a standard build system. The fact that every single project has a unique build system and unique way to resolve dependencies means that the majority of projects I encounter can't even be built outside of the authors machine let alone easily integrated or reused.

Even hobbyist languages being made today have this and I can't think of a single reason why an industry standard that is mocked for having so many additions to its standard, can't add those to it.

What I'm saying is I want this in C++, and as a STANDARD. cmake doesn't count since you do not have to use it.
> npm i
> go build
> cargo build
etc.
>>
>>85235572
Can be changed inside const Y. Now how it interacts with synthesized move constructor I've no idea.
>>
File: wcfeels.jpg (70 KB, 591x547)
70 KB
70 KB JPG
>>85235585
that is definitely a point of contention for any C/C++ project

but I would argue that the problems mostly arise from all the people not using windows, or at least, not developing on Windows. Learn to love the corporation and we can all just swap visual studio .sln files around anon.
>>
>>85235535
>better than rust
Syntax and keywords <<<<<<<<<<<<<<< well-worded code doing exactly what it's been told to do without too much level of abstraction.
>>
What 2d game framework would you recommend that exports to windows and linux? No engines like Unity and not too low level like SDL. From my research that more or less leaves those 3 I'll list but I'm not sure what to pick.

love2d is really nice, tried it a bit with a small game, good libraries and community but Lua is making me hesitant, probably gets hard to work with on bigger projects and debug

libgdx seems really good, a lot of useful functionality included like the texture packer and good asset loader, it's not really used much though, not sure why, is something wrong with java or java for games? Isn't Java very similar to C# which is commonly considered great for games?

Monogame is the most popular with best proven track record but the asset pipeline is shitpile from what I read, I'm on linux and I'm not sure if the whole ecosystem works well there, haven't used it. Not really familiar with it unlike the others.

Not sure what to stick with from those, don't know any other good choices.
>>
>>85235616
Joking or not, the projects which use vcpkg typically work for me regardless of what OS I'm using so it gets a big plus from me. I don't particularly like sln or visual studio compared to something plain text, but really I prefer NOTHING at all. The compiler can be smart enough to figure out how to build a project, especially if standards become enforced. Whatever cool tricks people want to do with the preprocessor and make files be damned.

Also projects made for Windows are typically better since the developers already dealt with most of the portability concerns. There's not usually any problems dealing with different path delimiters or things like whitespace in the paths, but all the Unix software I try not only doesn't work, the devs usually refuse to fix it.
2022 and they as a collective have decided that the floor is so long they can't even abstract paths in a sane manner, and that doing something like having a space in your name is INSANE.

In contrast, I've never had this problem with younger languages. It honestly surprises me how people will write Rust programs without even considering Windows and they just build and run perfectly fine there. I guess because they abstract filepaths properly. Meanwhile people make jokes about C not being able to split a string.
>>
>>85235744
>floor is so long
so low*
I'm angry, angry about software. Blinded by nerd rage. There's probably all kinds of mistakes in my own post, but not as many mistakes as in C++.
>>
>>85235772
angry nerd I beg to you, please answer the questions of this humble boomer.
What should I do to properly learn? Can you make a wage out of this if you are past X yo or is it capped by age?
>>
>>85235744
I wonder if eventually C++ will split from it's C heritage and become it's own language for real?
>>
>>85235734
>C# which is commonly considered great for games
Keep in mind this is only because of frameworks and engines like XNA and Unity that use C#. It's not because of C# itself. Technically, they don't even need C#, they work with any .NET language anyway.
>>
Hi im retarded and can't follow basic tutorials. Can someone help me get started setting up a C++ environment on linux mint? I don't understand how any of this technical shit works and just want to learn how to make vidya. kthx.
>>
>>85235917
Pygame.
>>
>>85229658
To check the case of a character you can use any of the following:
boolean isUpper;
boolean isLower;
isUpper = Character.isUpperCase(c);
isLower = Character.isLowerCase(c);
isUpper = Character.getType((c) == Character.UPPERCASE_LETTER;
isUpper = (c & 0b0100000) == 0; // Fast, naive
isLower = (c & 0b0100000) != 0; // Fast, naive

In the basic ASCII format the case of a character can be understood by inspecting the 6th bit. If the bit is set then it is lowercase, else it is uppercase. This is assuming that the character you are checking is actually a letter of the alphabet and not some other valid ASCII character. To get the first character of a string you can use the
String.charAt(int)
method.

https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Character.html#isUpperCase(char)
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Character.html#isLowerCase(char)
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Character.html#getType(char)
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html#charAt(int)
These docs are for Java 16 but everything I mention here is available since Java 8. Which version of Java are you using?
>>
>>85235815
I don't think age matters, it's the individuals and their traits.
I'm also of the opinion that you shouldn't learn to program just for profit or you're not going to be motivated enough to learn it let alone do it every day for a wage.
That said, I can't give advice on it since this field is so large. I don't know you or what you want well enough to give good advice, only generic shitty advice.
Consider edx.org I guess. If I wasn't beat ass tired I'd try to help you better.

>>85235830
That's what I want myself but it's not possible. The entire point of C++ is that it's a superset of C which implies compatability must be retained. This is where most of their problems stem from, they can only realistically add to the language. If you dropped C and even the bad parts of C++ it would be a whole new thing, which is arguable what new languages (e.g. Rust, Go, et al.) are anyway. They're not C or C++. C and C++ are C and C++.

That said if someone made a strict compiler for C++ that enforced the standards I wanted, I'd consider using it. But the bigger problem there is that not everyone else would so what's the point. It's a really tough problem overall for everyone.
So much of a problem that people make the decision to say "fuck this I'm making my own language" then they do.
>>
>>85235917
ok describe your problem maybe
>>
>>85235734
>not too low level like SDL
wdym low-level?
SDL2 have 2d rendering functions, it allows you to load textures from files (SDL_image library adds multiple format support) and render with or without hardware acceleration. So unless you can and want to write shaders for lighting, post-processing or particles, it got you covered.
>>
>>85235917
download and install "vscode" it's a less impressive version of visual studio for old shitty computers and linux users
>>
i created a python script to download memes from boards and threads
try it and rate it plox

https://pastebin.com/5wvP7Nkk
>>
>>85235734
Raylib
>>
>>85235999
Rust is not C++ without C, it's some fucking weird shit language that needs the real competence and corporate support C++ has to be great. If the C++ committee decided that after 2023 they were going to build C+++ and drop a lot of C baggage it would probably end up something fucking amazing.
>>
>>85236191
>inb4 it's just Rust but with random unneeded paradigms slapped on top.
>>
>>85235365
What do you mean? The FFT (and the STFT used to make Time vs Frequency representations) can be understood as a Filterbank AND as a transform. What I did to segment the image between frog calls and not frog calls was to use a series of morphological transforms (dilate, erosion, clean, etc) used in image processing (because the spectrogram is just an image lel). You can also try to see where there are frogs using a simple threshold (energy or frequency centroid for example), auto -r egressive methods or more recently, RNNs and other networks.

I tried using a decision tree with some parameters (zero crossing rate, short time energy and others) but the results where not good since these are time-domain only.
>>
How to write properly handling exceptions in asp.net core anons
>>
>>85236191
You're missing the point, it's that this
>If the C++ committee decided that after 2023 they were going to build C+++ and drop a lot of C baggage
isn't possible.

You can't have C++ without the baggage it has. If you want that you need to create a new language. Even if you do something like create a standard yourself like MISRA is to C, it doesn't mean anyone is going to use it, so you don't get any kind of interop or community around it that's particularly useful. It's more confusing because you're a C++ project but you're forbidding most of C++, and you also can't interoperate with other C++ projects.
It just makes more sense at that point to make a new language.

Rust is just an example of a language where the authors were fed up with C++ so they did exactly that. The same is true for Go. The developers of both thought it would be easier to just make new languages, so they did. Likewise with D and plenty more.
>>
>>85236191
Rust is an ML language, mascaraing in C-isms.
Rust is just Haskell with better pattern matching and a worse type system.
>>
use ats2
>>
>>85236274
My argument is that if the C++ people created the next C++, it would be better than Rust or any other competitor, in my belief.
>>
>>85236288
>better pattern matching
>>
>>85236274
>Rust is just an example of a language where the authors were fed up with C++ so they did exactly that
I disagree. It's more like people with experience with ocaml/other ML descendants and FP were using C++ and by the time of C++11 or 14 they went
>this is ridiculous, I can do this way better
and so they did
case in point >muh syntax isn't another clone of C!
>>
>>85236333
The thing C++ developers/committee does exceptionally good is pleasing boomers with backwards compatibility. In terms of lang development they aren't really more competent than devs of other langs. Some would even argue the opposite, considering the messy state C++ is in.
>>
>>85236333
std::visit
>>
hi /g/ - I currently know java, kotlin, rust, and some minor scripting languages. should I learn c++ or c? why? what benefits will it grant me? genuine question, i have some free time and i want to learn a new language and i want it to not be a meme language
>>
>>85236230
>Rust but with random unneeded paradigms slapped on top.
that already exists, its called rust
>>
>>85236365
Maybe but I'm pretty sure I remember reading accounts from the Firefox developers saying that one of the reasons Rusts exists had to do with C++'s build system in relation to cross platform stuff. I can't remember the specifics and might be making that up though.
I'm more confident in Go since Pike's account of that is pretty well known. Go only exists as a reaction to a C++ standard related announcement.

Regardless, that's not the point. The point is that C++ can't exactly drop C compatibility since that's one of its features. If you wanted to change the syntax, and other features it'd make more sense to just make a new language.
It has nothing to do with Rust or Go specifically. It has to do with the relation between C++ and C, and older C++ standards themselves. Like >>85236380 is saying. Compat is a goal of theirs.
>>
>>85236451
other suggestions than c or c++ welcome, those were just examples. preferably compiled lang, nonmeme.
>>
>>85236459
Anon...that's the joke they're making.
>>
>>85236333
std::visit, std::move, std::vector<bool>, std::begin, std::end, std::transform, how many constructors are we up to now, 5?, std::copy_if, std::remove_if, P0267R9, std::string (it doesn't enforce encoding), object slicing
>>
PHP or .NET/C#? Local job market is flooded with both
>>
>>85236551
what's wrong with vector<bool>? it's a template specialization that packs the bools into bits, right?

and those algorithm functions are the reason I love using C++
>>
>>85236191
>If the C++ committee decided that after 2023 they were going to build C+++ and drop a lot of C baggage it would probably end up something fucking amazing.
not going to happen
https://cor3ntin.github.io/posts/abi/

big tech companies gave up on the committee and focus on their own libraries and tools. clang development has slowed dramatically due to lack of interest in implementing C++ standard features that aren't worth the effort.
https://clang.llvm.org/cxx_status.html
https://en.cppreference.com/w/cpp/compiler_support
>>
>>85236501
The recent viml update showed one way forward: let users opt in to a backwards compat break at the function or file level. Old code runs exactly the same as before, new code can take advantage of new features.
>>
>>85236553
I don't know much about PHP but I don't think there is even a comparison. C# !
>>
>>85236587
That's not only a good way to handle it but you reminded me that someone linked exactly that for C++.
https://www.youtube.com/watch?v=PFdKFoQxRqM
No clue the status of this though. Maybe there is hope after all.
>>
>>85236642
>No clue the status of this though. Maybe there is hope after all.
very dead and the boomers wanted nothing to do with it to move the proposal forward
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1881r1.html
>>
File: 1641906102320.png (208 KB, 640x537)
208 KB
208 KB PNG
>tfw tesla self driving is C++

Rust btfo.
>>
>>85236714
Has anyone figured out the point of rust's string + operator?
>>
>>85236738
?
https://doc.rust-lang.org/stable/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
>>
>>85236642
that's a really interesting talk, I hope they can convince the compiler people to actually implement that. It just seems like they are offloading a shit-ton of work onto them to make it happen, but it would be pretty great. That guy giving that presentation to convince users and stakeholders in the language is one of the reasons I like using C++ so goddamn much. They try hard and are generally pretty competent about the changes.

inb4 nitpicking about x feature
>>
sicp ex 1.29 fucking me up senpai
>>
>>85236762
So you either get an unusable/moved variable or do an unnecessary clone of something that will again be copied into the new string.
So powerful.
>>
File: 1569490236294.png (100 KB, 487x404)
100 KB
100 KB PNG
>>85236818
Ready to be mad? >>85236713
>>
>>85235964
Java 8 I believe, and we're forced to use Eclipse. Thanks, I'm gonna try it out
>>
>>85236858
what else do you want, sweaty?
>>
Why is Go's module system so fucked up? Why does it make it hard to import a package relative to the local directory? Building a project should have nothing to do with publishing it. Why can't the import statement just do local paths???
>>
>>85236879
What exactly are you talking about?
Go's module system was only retarded before the version 1.11. How are you using it?
>>
>>85236819
tfw wouldntr cut it at MIT
>>
>>85236870
I already mentioned the problems. So what's the point of string+ when you almost always use concat! (for literals) and format! for everything else?
>>
>>85236979
If I have a project "foo" which contains two modules, A and B, where A depends on B, then I can't just write

import "./internal/b"


inside of a Go file for package A. Instead you have to add this
to go.mod, for every single package:

replace internal/b => ./internal/b
require internal/b v0.0.0


Because go wants to actually download the package and store it in $GOROOT or somewhere, instead of just having a local package. Why shouldn't I just be able to use import "./internal/b"?
>>
>>85236879
But it can:

import "./my/module"
>>
>>85237095
anon everything is online and internet-reliant in current year, cope chud.
>>
>>85237095
>GOROOT
It wants it in your GOPATH/src. If your local packages have go.mod files you can just import them by their name.

~/go/src/A with a go.mod name of "whatever" should be able to be imported via
import "whatever"

Or something like that. I never do local only shit because I publish all my works.
>>
>>85236862
You're welcome.

>Java 8
Oracle need to kill Java 8. It's recieving support until at least 2030, which is longer than even newer versions of Java. So many students will learn Java 8 and be completely blind to the wealth of changes made since then in terms of both syntax and standard API.
>>
>>85237095
You should be able to do
import "foo/internal/b"


Imports always start relative to the project root, not to the current module.
I have no idea what you're doing.
>>
>>85237013
it was added pre-1.0 when someone probably thought it should be overloaded for that because other languages do it. it can be convenient for some cases. i believe it's widely considered a mistake but your issue with it isn't clear.
>>
>>85235585
>cmake doesn't count since you do not have to use it.
Then neither does cargo or npm, you don't have to use those either.
With CMake presets like in >>85233876 this is just
cmake --preset=dev
cmake --build --preset=dev
>>
It's the year 2222 - 20 and /dpt/ still can't implement or find an alternative to `Console.ReadKey()` in their favourite toylang.
>Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window.
keywords:
- 'next' no need to hit Enter to submit input.
- 'function key' even Enter and Backspace are valid input.
>>
>>85237314
>Then neither does cargo or npm, you don't have to use those either.
You're picking on that sentence rather than the whole post. Those are standard. Cmake is a defacto. You don't have to use the go tool to manage go dependencies either and can use make, but nobody does because why wouldn't you use the standard.
Not to mention the npm problem has since been amended in deno, and cargo ships with Rust.
I don't know of any platforms that ship gcc or clang with cmake by default and furthermore while 90+% of projects in Rust and nodeJS use those managers, you can't say the same for cmake.

These aren't even in the same ballpark and your semantics is just that.
>>
>>85237360
nobody is going to do your homework Pajeet
>>
>C has an explicit feature where you can make a function that won't return anything
>int main(); return 0;
Why are programmers like this?
>>
>>85237394
main should return the program exit code
>>
>>85237394
That returns an int, you want
void main()
although I think most systems will still return 0 with that, I don't remember what the spec says.
What's the problem?
>>
>>85236860
someone needs to tell them that there is so much goddamn baggage we need just one new epoch to get rid of most of it and that will be enough for another ~30 years hopefully
>>
>>85237387
>xer shitlang can't even get a single key
Many such cases (C, C++, D, Rust, Java). Sad!
D is the most pathetic. It has to resort to using C bindings for getc because the stdlib only provides readln.
>>
>>85237394
if you return anything other than 0 then the OS will usually determine that to mean your program encountered an error.
>>
>>85237360
>- 'next' no need to hit Enter to submit input.
this has nothing to do with the language, it's interaction with the shell
>>
>>85237385
CMake is used by more than half of C++ and C projects according to JetBrains' and various surveys, with the usage numbers growing year by year.
npm is forgone in favor of yarn in a considerable number of projects as well.
C++ and C projects vastly overshadow your average eternally 0.0.1a Rust projects in complexity and platform support as well and while CMake is perfectly capable of handling all those situations, 3.0 was only released 8 years ago which is a pretty short timespan in the context of C++ and C projects. It's actually a pleasant surprise that CMake has the market share that it has right now.
>>
>>85237449
is knowing basic x11/win32 supposed to be impressive?
>>
>>85237360
#include <stdio.h>
#include <termios.h>

int main() {
struct termios t;
cfmakeraw(&t);
tcsetattr(0, TCSANOW, &t);
int c;
while((c = getchar()) != EOF) {
printf("char: 0x%x\r\n", c);
}
}
>>
>>85237491
That's good to hear, I hope the trend continues. But full on adoption into the standard would still be ideal. (or whatever else they would decide to do as long as there is a single reference standard rather than none and full reliance on defacto)
I do however suspect those numbers are inflated if they're only gauging public projects, and hopefully are filtering out forks.
But the real issue is how cmake configurations themselves can change. Just because a project uses cmake doesn't necessarily mean it's going to build. While you can argue that's true for the others, I'd wager it's less as common on a wider matrix of platforms too. Whether that's considered a fair comparison or not is up to you since the benefits there may be more attributed to the language than the build system, although I'd say that's part of the point being made.

Random anecdote; just last week I had I think 3 different cmake projects fail to build despite the documentation saying it should and what command line to provide.
Like I mentioned with Rust, I never seem to have this problem even on systems that aren't even officially supported. I've built Rust programs on Solaris using my own bootstrapped compiler and I guarantee the program devs are not even aware that OS exists.
>>
>>85237634
>full on adoption into the standard would still be ideal
It's foolish to think that this will ever happen or that it would be productive to make it happen. Compilers haven't been standardized and the result is a vibrant ecosystem of different implementations.
The committee has better use of their time than trying to appease such non-concerns.

Bloomberg also recently had employees claim at CppCon that majority of their internal projects use CMake and they do not enforce any build system in particular, mainly because that would not be productive use of anyone's time.
>Just because a project uses cmake doesn't necessarily mean it's going to build
It's MUCH easier to unfuck a CMake build than make, which is the next most popular choice. I'm talking from experience since I package libraries.
>>
>>85237709
>It's foolish to think that this will ever happen or that it would be productive to make it happen.
Ideal doesn't mean expectation.

>The committee has better use of their time
They do not. This has been proven by the committee.

>trying to appease such non-concerns.
The lack of addressing these concerns is what gives rise to the languages which will likely supplant it.

>It's MUCH easier to unfuck a CMake build than make, which is the next most popular choice.
No doubt, but that's not saying much. And unfortunately I still see people suggest make, even in academia.
>>
Does NodeJS have anything to offer to me as an experienced .net backend developer?
I'm gonna go freelance and saw a lot of nodeJS projects, but it looks terrible. It looks about the same, but less and with worse syntax.
I would assume its popular in jobs, because there are a lot of JS developers and its easier to take those than have them learn a different backend language?
>>
>>85237605
Talk is cheap. Show me teh code.
>>85237610
+1000 internet points has been deposited to the Linus Cnile Foundation account.
Other shitlangs can only watch or bind to C. Pathetic.
but
>linus only
>\r\n
>>
>>85236580
it's template specialization that breaks compatibility with most code that uses containers, the standard literally defines the criteria for what a container is and vector<bool> does not meet them
vector<bool> is the epitome of C++ monkey see dynamic arrays, monkey want dynamic array, monkey make dynamic array, monkey think money smart so monkey make one dynamic array different, monkey now stuck with shitty implementation forever
all C++ and its standards committee is good for is reimplementing others' ideas, which they've been doing, badly, since forever ago, starting with Stroustrup and C with classes

>and those algorithm functions are the reason I love using C++
then you may be happy to know that basically every single other major language does them better (except I guess Go)
>>
std::vector<bool> did nothinig wrong
>>
when did gnu adopt this tranny art?
>>
std::cout << condition ? "ok" : "not ok"; // prints condition
std::cout << condition ? "ok" : "not ok" << '\n'; // error
std::cout << (condition ? "ok" : "not ok"); // prints string

can someone explain it to me?
>>
>>85237789
>Other shitlangs can only watch or bind to C. Pathetic.
Because it's an operating system issue.
>>
>>85237491
I just don't like that in order to use Cmake I have to read lengthy documentation details and then basically write another program in the Cmake language to get it to do what I want.

That is already beyond obsolete.
>>
>>85237829
ternary operator

(boolean expression) ? do_if_true : do_if_false;
>>
>>85237829
https://www.tutorialspoint.com/c-cplusplus-ternary-operator
>>
>added a QQuickView widget in the main window with Qt Designer
>added a QML in QRC
>set the path of the QML (from QRC) as the source in QQuickView
doesn't seem to work, when I press debug the window is empty wtf
>>
>>85237857
>>85237874
>retards answer first
I'm asking why it behaves like this

all I can guess is that << takes precedence over ?
so the return value is not a stream from << but outcome of ?
so that's why chaining creates an error
>>
>>85237915
>QQuickView
I meant QQuickWidget
>>
I have like 28 chapters left in this book. I can't take it anymore, just gonna make my own project and search up what I need to do. I want out of this hell
>>
>>85237829
in haskell this is just
putStrLn . bool "not ok" "ok"
>>
gonna cry bros I can't solve this problem
>>
>>85237932
auto condition  = true;
std::string st r= std::cout << condition ? "ok" : "not ok"; //prints 1
std::cout << str; // prints "ok"

yup, this is valid
>>
>>85237749
>>The committee has better use of their time
>They do not. This has been proven by the committee.
So do you think they would do a good enough job at specifying a build system or do you think they are incompetent at what they are doing?
None of the other build systems you mentioned are specified in an ISO standard either.
>>
>>85237932
>Make shitty question
>Receive unwanted answer
>Gets mad at people trying to help
That attitude is why Stack Overflow is so hostile towards people making bad questions.
>>
How to break this down? VBA btw
Issue of optimisation/identifying pareto designs I believe.

Pic rel, 3 columns and up to 3000 rows for designs which are not sorted: ID (usually sequential but not always), Effectiveness, and Cost. Non-optimal designs are identified where for a given cost value, there are other designs in the table with an equal or lower cost value AND a greater effectiveness.

Minimise cost, Maximise effectiveness.
I am not sure how to frame this problem or how to best iterate through the array for this. Pls help.
>>
>>85236583
>https://cor3ntin.github.io/posts/abi/
he raises even more issues I forgot to list, damn
>>
>>85237829
(std::cout << condition) ? "ok" : "not ok";
std::cout << (condition ? "ok" : ("not ok" << '\n'));
std::cout << (condition ? "ok" : "not ok");
>>
>>85238030
wait the middle one might be
(std::cout << condition) ? "ok" : ("not ok" << '\n');
either way you get the point
>>
>>85237829
>std::cout << condition ? "ok" : "not ok";
std::cout << condition gets executed. Returned ostream is cast to bool, result of ternary operator is discarded.
>std::cout << condition ? "ok" : "not ok" << '\n';
Same, but you're trying to bitshift const char* by \n bits.
>std::cout << (condition ? "ok" : "not ok");
What you were trying to do, cout string literal based on condition. You can add << "\n" to it.
>>
>>85238008
>Make shitty question
or you are too stupid to grasp it
>>
>>85237829
sepples was a mistake
>>
>>85238014
do you just want a way to throw out all non-optimal designs, or are you looking for a single 'best' design?
>>
anyone into reversing and binary exploitation stuff? how deep would you recommend getting into bitwise operation? i dont really hear it coming up often but it seems like it should be really important to understand
>>
>>85238048
sepples can truly make a mountain out of a molehill
>>
>>85238069
The only people complaining about gatekeeping are the ones left outside.
>>
>>85238073
>bitwise
>reversing and binary exploitation
you should be competent with bitwise operators if you write anything more than a blog. as for reversing and binary exploitation, check out ghidra.
>>
>>85238089
Yeah, because looking up operator precedence takes two whole working brain cells.
>>
>>85238007
>So do you think they would do a good enough job at specifying a build system or do you think they are incompetent at what they are doing?
The latter. They're the gatekeepers of the standard so there's nobody else to mention. And it may be obvious that I'd rather use any other language if possible, preferably one that has such standards as a first principle.
It doesn't matter if it's ISO or just domain specific to the project, as long as it's a canonical standard of some kind of the language.
What this means in my own words is that the people responsible for publishing and distributing the reference compiler, publish and distribute the reference build system. Like is done in the languages+tools mentioned.
This allows people to deviate from the standard if they want to, but the ideal is that they should never want to. The reference should ideally be good enough for the vast majority of projects written in the language.
*imo

For example, if tomorrow the committee said that henceforth cmake is the reference C++ build systen, I think it would at least be a step in the right direction and a big milestone of the language. Hopefully killing off some of the other projects attempting to fill that void, and aiding in converging everyone on a single standard. Both in terms of use, and in contributions.
Without it, each system is effectively on equal terms. Today I can say "why not use build2?", tomorrow I'd like someone to be able to say "because cmake is the standard that you can rely on". At least in a formality.
>>
>>85236139
I don't really know my problem, I click run and informs me its unable to do so. This is not a syntax problem so much as the ide and compiler just aren't talking. its not even reading the code in the first place. Which is why I I wanted to know how to set up from scratch.
>>
>>85237829
because the language rules evaluate the fucking ternary before it goes into the output stream apparently

are you asking us to explain their logic for making that decision? hell if I know
>>
>>85238156
other way round
>>
File: pareto.png (15 KB, 638x461)
15 KB
15 KB PNG
>>85238070
Not looking for a single optimal design. I am looking to plot a chart like this so I need to identify multiple 'optimal' designs and store them somewhere, along with the non-optimal ones too.
>>
>>85238156
I found out
<< is an overload of the binary shift and has it's priority
>>
>>85236819
Took me long enough fuck me, I'm fucking dogshit

(how do I turn off fractions in drracket I can't find it)
>>
File: 1575215304389.png (508 KB, 648x598)
508 KB
508 KB PNG
I want to create some cute code with rust.
>>
>>85238182
can't you just sort by cost and plot it like that? If there were no non-optimal designs, this would leave you with sorted efficiencies as well. Any design with an efficiency that breaks the sortedness is unoptimal, since that means there's a design with lower cost and higher efficiency.
>>
>>85237814
Why'd you create an array or a vector with boolean value?
>>
>>85238182
uh optimization is a whole field of study m8. Have you tried genetic algorithms? If you have clear parameters and a clear definition of your cost/result function then they are usually good.
>>
>>85238212
>>85238212
>>85238212
new
>>
>>85238262
oh it is VBA shit. Idk man just kill yourself prolly
>>
>>85238114
ostream has no business being a boolean.
ternary op should warn on discard
streams were a mistake.
Sepples' design took less than two brain cells to be.
>>
>>85238275
>ostream has no business being a boolean
Congratulations, you just broke while (getline) and similar widely-used constructs.
>ternary op should warn on discard
it produces 3(三) warnings for me, how much do you need to figure out that something is wrong?
>Sepples' design took less than two brain cells to be.
filtered
>>
>>85238469
Cope++
>>
I wanna do sometihng cool with uno platform but I don't have any idea. pls help
>>
I just realized I'm not quoting strings in my switch statement and it's working.
given ($href->{entry}) {
when (A) {
say "A";
}
}

This doesn't even generate a warning!



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.