old thread >>54225619
What are you working on /dpt/?
>>54231666
>What are you working on /dpt/?
>/dpt/?
This used to be "/g/"
>>54231666
Shitting out a presentation due Thursday
I almost got the whole thing done, but goddamn is it awful
>>54231712
You really want to include the consumerfags in this conversation?
I want to write a simple interpreter in C.
How does one accept input?
Do I just take input from stdin and wait for the user to press enter?
>>54231692
>Java jobs web dev
I'm sure there is also mobile.
It's because most jobs are web and mobile now. Desktop software is almost dead/oss (you could try applying to JetBrains I guess, they use java plenty), for internal enterprise apps windows+c# is usually preferred, a lot of java ecosystem (web frameworks, tooling) is open-source, so there aren't that many job openings to work on it. Videogames are c++/c# so there isn't much left. There are decent machine learning libraries as far as I'm aware, so I suppose it is used some in research, but python is more popular. So here you go
>>54231812
input from a file and create a parser. This will work like a program interpreter. For a line parser like the one python has, you should do like you said.
I wanna make a chat client/server in qt :D anyone want to help ?
>>54232019
Sounds like an interesting enough idea. What kinds of features do you want to support?
I'm currently learning to program in TCP/IP so far it's been easy in C with I've managed to create a connection and send strings, it works as expected, I imagine with Qt it would be easier.
>>5423211
I want to have an alternative to facebook chat, what features ? very basic like going back to old microsoft messenger but before being a bloated and unstable shit with aggressive ads
>>54232019
protip: https://en.wikipedia.org/wiki/ZeroMQ
>>54231666
How do I do this?
>Through this assignment, you will learn how to use multiple threads in you Java application programs. The assignment is to write a multithread Java program that performs matrix multiplication. In the program, you need to calculate each element in the result matrix in a separate thread. For the convenience of programming, two sample matrices could be included in your code. However, your code should be generic with regard to matrix size. The sizes of three matrices should be stored in variable and used. The two operand matrices and the result matrix should be printed.
I can make a multithreaded program that prints strings, and a program that multiplies matrices, but I'm not sure how to make a multithreaded matrix multiplication program.
>>54232180
TYSFM anon hahaha I knew /g/ would help
>>54232205
[A, B, C] X [E, F, G] -> [AE + BF + CG]
just let each thread do one of those calculations
redundant because its like 5 instructions and no wait
>>54232205
when you matrix multiply, you do row times row = 1 value
because all the values of the matrix are independent, each index of the matrix can be calculated independently
i.e. if you're multiplying two 4x4 matrices, the resultant matrix does not have any shared data location for each multiplication, so it can all be done in parallel (i.e. each matrix index can get its own thread in a really naive solution)
sorry if that is somewhat confusing but that is the idea
>>54231666
Dumb question, but I'm having some cin trouble.
So, at the start of my small menu program, I need a cin.ignore() otherwise it skips the first thing where I ask if the user wants a short readme.
So then it jumps down to "what do you want to add?" This is where I'm having a bit of trouble, and I don't see any way around it. Let's assume I don't have a cin.ignore() The first time, it will go off without a hitch. It'll get some more input from the user in a class function, then hop back to main and continue doing menu shit. Second time around, it will just skip past it.
BUT, if I add a cin.ignore() to it, it will work all times after the first time, but fails the second time. The problem with the first time is it ignores the first character because I didn't enter a complex input.
I'm not sure how to really remedy this, save an if statement checking if I've already run this switch case once. Any advice, /g/? I can whip up a mock code real quick if it isn't really all that clear.
>>54232295
try flushing stdin
post code too
I'm making an RPN calculator!> 32.2
5: 32.2
4: 32.2
3: 32.2
2: 32.2
1: 32.2
what you typed: 32.2
Now i just have to write the parser.
>>54231666
https://github.com/Yetoo1/Fuck_You_Game
>>54232311
Okay, I mocked up a menu code since what I have right now is kind of a hot mess. Problem still happens with it though.#include <iostream>
using namespace std;
void printMenu()
{
cout << "1. This is the only option" << endl;
}
int main()
{
bool readme = false;
char choice = 0;
while(choice != 2){
printMenu();
cin >> choice;
switch (choice){
case '1':{
if(readme == false){
cout <<"Do you want to view the readme?" << endl;
cin.ignore();
string ans;
getline(cin,ans);
readme = true;
if(ans == "yes"){
//display the readme
}
}
cout << "Enter what you want to add" << endl;
string item;
cin.ignore();
getline(cin,item);
cout << item << endl;
//add item to class, gets some more inputs from user
break;
}
case '2':
cout << "bye" << endl;
break;
}
}
}
So same as before, first run through, when it asks for the user to enter an item after the readme, an input of "string" will be read as "ring".
Haven't seen anyway around it, so if anybody had a suggestion, I'd appreciate it.
Anyone have somthing that can explain to me how heap allocations work.
I'm running into something called an "exponential heap" and seeing a program allocate one big 1gb chunk of ram and using its own allocator to pick at it. Never took the time to understand that stuff myself.
>>54232434
now I just need an interpreter> 32 16 4
3: 32
2: 16
1: 4
what you typed: 32
> q
Ask your elegant and much beloved programming literate anything (IAMA)
>>54232499
heap is memory allocated in the dynamic environment.
>>54231812
https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
http://www.buildyourownlisp.com/
>>54231712
But /dpt/ is know as the best subreddit of /g/
>>54232768
>heap is memory allocated in the dynamic environment.
i know what the heap is.
I'm talking about the strategies involved in allocation and deallocation from a chunk of continous memory.
why python is the best language?
Rate my RPN calculator!> 2.01
3: 37.2487
2: 1.71
1: 2.01
> /
2: 37.2487
1: 0.850746
> /
1: 43.7836
>
>>54232456
>while(choice != 2){
>printMenu();
>cin >> choice;
>switch (choice){
>case '1':{
This isn't exactly related to your problem of the skipped input, but you are comparing choice as the integer value 2 in your while loop, and the ASCII value for the character '2' everywhere else.
Aside from that, I suspect your problem is due to the differing behavior of cin << and getline() when it comes to the newline. IIRC, cin extracts characters until the first whitespace character is reach, but leaves that character in there. getline extracts characters until a certain length or the newline, but extracts the newline as well. Double check the details of that - cin can be configured to extract whitespace, and getline can be configured to leave it.
You can try tinkering by putting the ignore after the cin, but I personally like to do all of my reading consistently (i.e. use cin and only cin, or getline and only getline) because it avoids weird surprises like this. I also tend to read user input into a string first, then deal with it from there, but I can understand wanting to avoid the complexity at this point.
>>54232869
that very implementation defined. are you talking about how it's done by the vmm (kernel/server) or the allocator (eg: malloc)
>>54232869
read alexandrescu, "modern" c++ design
Looking to join a C++ open source project.. have plenty of experience. Don't want to get overwhelmed by something huge.
Anyone have any suggestions or any projects they need some help on?
>>54232980
why this book 15 years old
>>54233057
how are you with reverse engineering.
or at least appropriating reverse engineered into into a "trainer"(injected DLL).
i could just toss a git your way and you can crit/pull request even
>>54233062
because it covers custom allocators in depth
>>54233073
I've done some things of the sort anon. If I can't do it, I'm willing to learn.
Unfortunately, I won't be able to help until my schooling settles down. Do you have a preferred way to contact?
>>54233073
what's the target game?
fuck, I've been asking about this for a few days...
is it worth it for a linux guy to learn C# for android/mobile in general/desktop dev?
>>54233089
>>54233095
dark souls III
If you've heard of ElDorito that was me too.
>>54233110
>desktop
it's a bit of a shaky bet right now, you will 100% depend on the success of .net core and whether it will even have support for any kind of cross-platform GUI frameworks in the future. Mono has GTK#, but .net core is the focus of the community now, I don't know what the future holds for mono.
>mobile
yet it should be fine
>>54233143
I'm definitely interested, anon. Could we establish some form of contact?
>>54232768
why do you wear the mask?
do you know of any good matrix maths libraries for D?
Learned how to program in college, post-college now looking for a job. I spotted a github for a little project that used mac "say" command and got my own replacement (pttsx) to text to speech instead.
Thing is, while Python is pretty dirt easy to learn so far, I can't fucking figure out after installing this package/module with pip how I get it to be recognized by the .py script I'm running on my desktop. It fails/errors on the import for the package and usage of objects from it, because pip install wasn't enough.
How do I get access to this library from a random desktop script?
>>54233193
Run it with a terminal, tard
pip should be tied to "python scriptname.py"
>>54233193
Did you install the right version of the package?
ie the 2 version as opposed to the 3 version or vice versa
RPN calculator!
now with unlimited stack!./hpsh
> 8.33 4 5.2 - *
1: -9.996
> 8.33 7.46 - 0.32 *
2: -9.996
1: 0.2784
> /
1: -35.9052
> 4.3 3.15 2.75 - *
2: -35.9052
1: 1.72
> 1.71 2.01 * - /
1: 20.9104
> sqrt
1. 4.572789
>>54233149
thanks anon, guess I should learn it just for the sake of learning a new lang, but after that, I should get a java refresher... because I don't remember shit :/
>>54233224
I'm running it both in command prompt locally and in Idle.
>>54233240
Sorry broski, I'm not sure how to tell the difference. The installer didn't give an option, and when I pip'd it over it didn't hiccup at all. It seems to be installed in 3.5 folders under "site-packages"
>>54233167
can I hear a bit more about your experience
the git's still got a lot of unpushed commits and research to be done but i'm porting over old ElDorito code and improving it as I go.
>>54233257
What package was it. Import names can be different for each package depending on if you're using Py2 to Py3
>>54233257
In the terminal, you're usingpython3 script.py, right?
>>54233275C:\Users\Computer\Desktop>python --version
Python 3.5.1
C:\Users\Computer\Desktop>python tsa.py
Traceback (most recent call last):
File "tsa.py", line 6, in <module>
import pyttsx
File "C:\Program Files (x86)\Python35-32\lib\site-packages\pyttsx\__init__.py", line 18, in <mod
e>
from engine import Engine
ImportError: No module named 'engine'
>>54233246
you just gave me an idea
>instruction set simulator
>stack machine
>huffman encoded binaries
the filesizes man just imagine
>>54233292
Was google too hard m8? http://stackoverflow.com/questions/29615235/pyttsx-no-module-named-engine
>>54233082
this book old as fuck lmao
>>54233314
>http://stackoverflow.com/questions/29615235/pyttsx-no-module-named-engine
I suppose it's easier than reading comprehension or basic debugging skills.
Asshat, it's not even finding the fucking module to import at all. That means it's not getting into those files to find those errors.
>modern programmers
>>54233261
Sure.
Plenty of experience involving x86 assembly, not with floating point numbers or any of the more complicated instruction subsets. I use Immunity Debugger to debug programs, it's basically Ollydbg with some nicer features to get around a few things.
As far as trainers are concerned, I've done plenty of stuff with Cheat Engine... more than just modifying memory values. Sometimes it gets more complicated, you need to actually modify memory resident code.
As far as DLL injection is concerned, one project I did grabbed a password from an authentication login application (proof of concept.) Since the field was set as a password box, it was only readable by the parent process. i.e. I couldn't just read the memory from the process. I had to actually inject a DLL to read the field and transfer the information back to the injector process.
Decent amount of Windows API experience, sort of goes without saying since I did the DLL injection thing.
Most important thing is I'm willing to learn. I go to a pretty good university, but they don't teach things like this. I have a burning desire to learn new things like this (especially rev eng and security.)
>>54233329
Retard it's the same error on SO
>>54233375
No its not, and the fix they suggest doesn't change it at all. It CANNOT FIND ENGINE in the same folder for some reason. Can you not do debugging? Christ, I knew I left /g/ 7 years ago for a good reason, I'm just too crotchety and angry to deal with ANY other userbase, but now most of you can't fucking program let alone into tech.
>>54233340
Sounds good. Kinda similar situation in terms of uni. email is my github name except gmail. I have a discord channel too for instant messaging if you're into that.
Never heard of immunity debugger.
I use IDA pro and sometimes radare.
>>54233389
Does someone have to remind you to breathe every ten minutes or can you do that on your own?
>>54233392
w*****[email protected]?
>>54233412
yep
>>54233301
>instruction set simulator
Do it in verilog.
>>54233425
Verify you got the email please.
>>54233405
10/10 response. Even with patches the pyttsx lib had issues, I found a half-assed updated one for 3.5
>>54233438
I don't know shit about hardware desu
>>54233460
replying now.
>>54233477
you could easily learn
there are simulators, and learning it isn't that different than learning a programming language. It is a programming language after all.
>>54233477
It'd be fun to do the real thing not just some simulator.
>>54233497
well, it's kinda hard to grasp for programmers at the beginning, as it's a completely different paradigm from what they are used to, but not so hard overall and you don't really need to know much about digital electronics.
>>54232913
i don't know what that is but 10/10 for being cute desu
>>54233301uint output = func(*cast(T*)&a, *cast(T*)&b)
stack.push(*cast(T*)&output);
there's something I love about low level programming where you just jump right off the deep end and throw away the type system altogether
>>54233497
>>54233594
I'm going to write up a prototype and hack around with it so I can figure out opcode frequencies to build the huffman tree
>>54233599
https://en.wikipedia.org/wiki/Reverse_Polish_notation
https://en.wikipedia.org/wiki/Stack_machine
it's a really fun project to whip up desu
plus you can expand it to parse infix expressions like 1*4+2-7/2 into 1 4 * 2 + 7 2 / - and then evaluate them
it's a great learning experience
>>54233599
it's a postfix, stack-based calculator, like you see on old hp calcs
it's actually quite easy to parse, and because of it, any decent interpreter will convert infix expressions to postfix (or RPN) before evaluating
>>54230932
>>54231093
Oh, also, if you only use a const in a method should you put it in the at the top of the class, above the method, or in the method?
whatta you listening to atm?
me: https://www.youtube.com/watch?v=K8ThbW2zTjU
How come pascal(1970) has strings, but C(1972) doesn't?
> consider the followingclass Base
{
Base();
virtual smth(){};
};
class Child : public Base
{
Child();
};
class Foo : public Child
{
Foo();
};
Foo::Foo()
{
// How to call smth()
smth();
// clang error: non-static member 'main' found in multiple base-class subobjects of type 'Base'
// Explicit
Foo::smth();
// clang error: amiguous conversion from derived class 'Foo' to base class 'Base'
}
>>54233778
Stop using such a shitty meme lang.
>>54233769
C has strings. It just doesn't have a string type.
>>54233778Base::smth()
also don't make constructors private if you won't them to be inherited
>>54233856
am i drunk or smth
>won't
*want
>them
not constructors, the classes, naturally
>>54233843
Yeah, I meant string type. A secure one, not messing around with char arrays/pointers.
>>54233769typedef char* string;
>>54233867
NULL
TERMINATED
BYTE
ARRAY
>>54233856Base::smth();
// clang error: ambigious conversion from derived class 'Foo' to base class 'Base'
> also don't make constructors private if you won't them to be inherited
yeah thanks, forgot to include thepublic:in the example
>>54233864
char pointers are fine.
There are all sorts of arguments for/against null terminated strings, but pstrings or something similar doesn't really "fit in" with the rest of C.
>>54233867
Wew lad. That's not how this work. You have to malloc n shit.
do we have an irc?
>>54233900typedef char* string;
string str = "read your K&R this is legal";
>>54233769
While Pascal's strings are far superior to C's "strings", they still fucking suck. Fucking 127 character limit.
>>54233908
A char * doesn't guarantee that it's a sequence of (multibyte?) characters followed by a null terminator.
Since there is no type in C which guarantees this property, there is no "string type" in C.
>>54233891
https://ideone.com/clkNss
>>54233912
I didn't know about that. That sucks.
>>54233908
What you just did is a string literal. Why is it illegal?
>>54233864
C isn't supposed to be secure (unfortunately enough)
>>54233912
127? not 255?
>>54233940
security and forced safety nets introduce overhead
enforcing program correctness should be left to the developer, not the compiler.
>>54233940
Well yeah, I just wondered why? I mean, a proper string type would've gotten C more market share.
>>54233951
No. The first byte is used as the length indicator.
>>54233956typedef struct {
char *str;
int len;
} proper_string_typeTM;
>>54233955
>opinion
>opinion
A sufficient type system can enforce quite a lot of program correctness at run time. C is nearly bare minimum, and history should be more than enough evidence to show that it hasn't always been a good thing.
>>54233956
Do you really think C needed more market share?
Apparently simplicity over safety worked well enough for people to not notice how much better the alternative could have been.
>>54233951
>>54233972
Nvm, for some reason I thouht that Pascal used a signed byte for the length. My excuse is that I just woke up.
>>54233978
*correctness at compile time
>>54233930
> cheers anon. have a good day
>tfw scared of growing old and becoming a shitter programmer
this is kind of all i have right now
>>54233973
I didn't ask you to make a type for me. I just wondered why C doesn't have one by default.
>>54233978
I guess you are right, but seeing how overly complicated and verbose compiled languages are now, I'd rather have it that C influenced more devs.
>>54233908
>k&r meme c
kek
still have to malloc or somehow get a pointer to the data, can't just simply pass a value into it
>web hosting service doesn't list the pricing for if you exceed the allotted traffic/storage
>send email to their support
>email doesn't arrive because something is wrong on their end
fucking amateur web fag normies REEEEEEEEEEEEEEE
>>54234053
>I just wondered why C doesn't have one by default.
because then C would become a bloated mess like C++
>>54233928
Who says it has to be null terminated? That's just a convention for the standard library. It's ultimately up to the programmer to decide how they want to handle strings. If they want to construct a struct that'll hold a pointer and a length field, and maybe a capacity field, that's their choice. Indeed, in many language interpreters -- written in C -- a custom struct is used for strings.
>>54233973
Length field should be a size_t, not an int.
>>54234056
that string literal compiles down a pointer to a read-only section of the executable that holds the string literal.
since it gets replaced with a dereferenced pointer at compile-time, you can also do weird shit like calling specific characters using array subscripts"ABCDEF"[3]will access D
>>54233973
>proper_string_typeTM
>>54233973
At least define something that doesn't completely suck:#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
size_t len;
char *str;
char _str[];
} string;
#define string_auto(lit) (string){ .len = strlen(lit), .str = lit }
#ifdef __GNUC__
/* Non-standard garbage, but is stack-allocated and modifiable */
#define string_auto_GCC(lit) ({ \
size_t len = strlen(lit); \
string *s = alloca(sizeof *s + len + 1); \
s->len = len; \
s->str = s->_str; \
strcpy(s->_str, lit); \
s; \
})
#endif
string *string_heap(const char *lit)
{
size_t len = strlen(lit);
string *s = malloc(sizeof *s + len + 1);
if (!s)
return NULL;
s->len = len;
s->str = s->_str;
strcpy(s->_str, lit);
return s;
}
int main()
{
string s1 = string_auto("test1");
string *s2 = string_heap("test2");
string *s3 = string_auto_GCC("test3");
printf("%s\n", s1.str);
printf("%s\n", s2->str);
s3->str[0] = 'f';
printf("%s\n", s3->str);
free(s2);
}
Although something like this would need a lot of utility functions with it to be useful.
>>54234100
>Who says it has to be null terminated?
That's just how the standard currently defines strings. I figured anyone wanting to do it today wants compatibility with the vast amount of C libraries that already exist..
>>54234151
>backwards indentation
I'm angry
so very angry
>>54234029
https://youtu.be/Le3lUGAA0hQ?t=20m30s
>>54234151
This looks real nice anon.
What's the best way to go about learning Rust?
>>54233057
Not me personally, but I know there's an ongoing project that is open sourcing the original RollerCoaster Tycoon games
Anyone thoughts on using an ORM for your database? I've worked with it some time ago and didnt really like it but it seems like it could save me a lot of time right now.
>>54234329
https://www.youtube.com/watch?v=lKwiqO8Nnms
>>54234246
Never mind, I just googled it and found the official tutorial.
can anyone point me in the right direction as to why i keep getting this error?...INFO3220_A1G/container.cpp:8: error: redefinition of 'Container::Container(std::string, std::vector<Container>)'
Container::Container(string name, vector<Container> containerObjects)
^
container.h#ifndef CONTAINER_H
#define CONTAINER_H
#include "body.h"
#include <string>
#include <vector> //std::vector
using namespace std;
class Container
{
public:
Container(string name,
vector<Container> containerObjects) :
m_name(name),
m_containerObjects(containerObjects) { }
~Container();
virtual void addChildren(vector<Container> &containerObjects) = 0;
virtual vector<Container> getChildren() = 0;
void setName(string name){ m_name = name; }
string getName() { return m_name; }
private:
string m_name;
vector<Container> m_containerObjects; //used to store objects in container
};
#endif // CONTAINER_H
container.cpp/home/edmund/#include "container.h"
#include "body.h"
#include <string>
#include <vector> //std::vector
Container::Container(string name, vector<Container> containerObjects)
: m_name(name),
m_containerObjects(containerObjects)
{
}
Container::~Container()
{
}
void addChildren(vector<Container> &containerObjects)
{
}
vector<Container> Container::getChildren(){
return m_containerObjects;
}
I think I nailed it right here
>>54234441
Why don't you try reading the error message?
>>54234576
>i read the book but i didn't understand it
>Why don't you try reading the book?
>>54231666
So I've got the creativity of a bag of sand.
Can anyone throw some suggestions at me of an intermediate desktop project I can make.
Really want to program something but struggling to think of something that isn't trivial.
>>54234590
>redefinition
There's your hint.
>>54234605
i mean why even respond if it's going to be some snarky, belittling little comment?
obviously i read the error message but i'm still not sure. i got rid of it since i suspected that it was a redefiniton (due to the error message) however now it's saying thatinvalid new-expression of abstract class type 'Container'
>>54234602
program a gf ai
>only viable cross-platform build tools are cmake and autoconf
>they're both awful
how?
there has to be a huge demand for it, and yet there arent any better alternatives
>>54234620
>tfw no reference to base it off
>>54234602
HP 35s emulator
>>54234613
>i mean why even respond if it's going to be some snarky, belittling little comment?
Because it's not my job to spoonfeed you, especially when it's shit that the compiler is already telling you.
>>54234645
>Because it's not my job
>my job
oh god it must be so damn hard carrying the entirety of this general on your back! how do you do it?
>>54234634
cool idea thanks
Currently testing C with.. Compcert. Yes.. my shit still works.
>>54234441
To fix the redefinition, remove the {} from the declaration of Container in the header, you're providing an empty definition in the header and then trying to add another definition in your source file.
To fix your instantiation error, remove the virtual from addChildren and getChildren or make a class to extend Container, keeping the virtual modifier and provide a definition for your function there.
>>54234653
you declared these methods as abstract
and now you're defining them
why? how do you guys get to this code? Do you read nothing at all and just throw random syntax constructs until it works/someone on the internet fixes everything for you?
>>54234628return "we're just friends, right anon?";
>>54233474
nigga you're too fucking stupid to install a python module
how does it feel to be dumb as shit?
>>54234663
>remove the virtual
he needs to remove "= 0" that doesn't let him define the methods, virtual is fine.
If I wanted to program my own Window manager, what do I need to get familiar with?
I heard X.org is terrible, any truth to that?
>>54234724
sorry anon, reading my reply I should have specified a little more, I'm on the way out the door so it was just a quick response to point him in the right direction since others weren't being particularly helpful.
>>54234737
study https://github.com/SirCmpwn/sway for example. It's for wayland. Xorg is terrible, it's 100% truth
>>54234737
anything that's not the native window manager to the OS you're using is going to be inferior
>>54234737
>I heard X.org is terrible, any truth to that?
X11 is VERY old, and has all sorts of legacy cruft with it. Also, security with X11 is a complete joke.
I've never done any significant programming with it though, but I don't think it takes a huge amount of code to write a window manager (dwm is less than 2000 lines).
If you want to write something modern without all of the X11 cruft, write a Wayland compositor, but that is significantly harder to do.
>>54234757
Isn't Wayland still WIP and unstable?
>>54234782
writing a wm for xorg is a waste of time imo, this way you'd at least learn something that may be of use later
>>54234782
Wayland is already at version 1.3. I think there is still a little tweaking going on with xdg-shells and other desktop stuff, but overall, it's pretty stable.
What's really needed at this point is good wayland compositors.
>>54234782
Wayland itself isn't unstable, but most DE's that try to use Wayland are unstable.
>>54234775
>dwm is less than 2000 lines
That does sound impressive, and I just checked out its Makefile, it's genuinely readable.
>>54234792
I'm still exploring my options for now, I may take a look at both.
>>54234802
I may try it out then.
>>54234866
I guess that's why everyone's still on X.
What's with Canonical's project though? Are we going to have both Wayland and Mir in the future?
>>54234931
>I may try it out then.
I've looked into it myself before. It's pretty damn involved.
There is a whole lot of shit you have to do yourself which used to be handled by the X server.
What would be the best way to produce a ceasar cipher in C?
Hey /dpt/, what is the best and most simple way to do C with Windows?
https://ideone.com/Sr25NY
Why does it display 2 DEL characters and not 16 of them?
>>54235000
a for loop
>>54235017
install gentoo
>>54235017
PellesC
>>54235034
I can download it, but it it a free solution?
>>54235017
CLion
>>54235000void caesar(char *str, int n)
{
int i;
for (i = 0; str[i] != '\0'; ++i)
str[i] = (str[i] - 'a' + n) % 26 + 'a';
}
r8
>>54235044
free as free beer.
>>54235022
it treats initializer list as a list of characters (2 chars with value = 16). Use a constructor.
>>54235062
OK.
>>54235045
I have to pay after 30 days?
>>54235030
I hesitate to install a vm with Arch.
>>54234602
I've been reading about something fun yesterday. Have you ever heard of a MOVE architecture? It's like an extreme version of a RISC processor.
So in this architecture your processor can only handle one instruction - MOVE. You do different operations by moving data to specialized registers, which produce side effects which are results of your operations. So if you want to add two numbers, you move them into two special registers for adding which triggers operation of addition on them.
Here's one way of doing it: http://www.ht-lab.com/freecores/move/move.html
I don't know if you're into things like that, but you could do a simulator of such a processor, maybe implement it in some hdl, try to modify the architecture in some way (I have some ideas), try to write some fizzbuzz for it etc.
>>54235064
You're a life saver, thanks a ton.
>>54235050
Does interesting things if you pass a null string tho
>>54235067
>I have to pay after 30 days?
Last time I tried it, you could download a dev build, and have the trial period reset each time, but I dunno now.
VS CE is gratis, and has pretty shit C support (C89 or something), but I think it supports clang too now.
>>54235111
like what?
I didn't run it desu
>>54235017
visual memio
>>54234931
Check out catwm, it's just 500 lines.
>>54235116
>VS CE is gratis
VIsual Studio?
>C89 or something
That's the only C I want to do. So it's perfection.
>>54235199
>VIsual Studio?
Yes
>>54235199
>That's the only C I want to do. So it's perfection.
Get with the fucking times, grandpa. C has evolved a lot since then.
>>54235223
C has only introduce useless feature like bool,nested function, possibility to declare vars everywhere. Nothing that really change the way of coding.
When .net has evolved it has introduced
generic, then lambda. That changes everything.
Modern C just introduced cosmetic changes.
>>54235034
>>54235045
>>54235116
>>54235133
Thank you for your help anons.
>>54235246
>nested function
That's a GNU extension, not standard C.
>possibility to declare vars everywhere
That alone would be enough of a reason.
>Nothing that really change the way of coding
None of them fundamentally change the language, but still adds several nice features.
>Modern C just introduced cosmetic changes.
You've never taken a good look at what they have added to C, have you?
You're missing out on all sorts of shit like VLAs, designated initialisers, compound literals, stdint.h, variadic macros, etc. just to name a few from C99.
What do you do when you've banged your head at a problem and can't seem to get anywhere?
>>54235290
I would go to the hospital
>>54235286
>You're missing out on all sorts of shit like VLAs, designated initialisers, compound literals, stdint.h, variadic macros, etc. just to name a few from C99.
Totally useless things that don't change the way of coding. You're a code monkey. Don't answer I will ignore you, I don't have time to lost with bad developers.
Why is C++ so bloated and shitty? C is much better.
>>54235246
>possibility to declare vars everywhere
Yes, let's hoist a dozen variables with no immediate context and expect the maintainer to keep track of every single one throughout the following control-flow-infested function.
>>54235325
Sorry I don't work with code monkeys. I work with skilled developers who can maintain such code.
>>54235310
>>54235338
>Totally useless things that don't change the way of coding
That's because you're retarded and stuck in your ways.
Also, you're some fuckwit with poor English who is asking about which C compiler to use. I highly doubt you're even remotely competent at programming, let alone C.
>>54235349
>I highly doubt you're even remotely competent at programming, let alone C.
Here we are.
>>54235349
>Also, you're some fuckwit with poor English who is asking about which C
kek, said by an angsty 15 year old Czechoslovakian fag who tries too hard yet fails at English more than those whom he criticizes
not even the person you're responding to btw
>>54235246
>being too backward to use complex numbers from C99
>>54235310
>liking stuff makes you a bad developer
Yeah, ignore and shut up, good riddance.
>>54235338
You 'work' in your mother's basement or have a job no one else would do, because no company who values getting stuff done hires princesses that bitch about people who learn to use modern language features.
why is everyone such a cunt in these threads
>>54235349
>>54235377
/int/ trolling now, srsly?
>>54235437
Welcome to 4chan. Now fuck off.
>>54235394
>about people who learn to use modern language features
Sorry for you. You're delusional.
Majority of C code is C89 (embedded). Only hipsters use modern C.
>>54235444
>Welcome to 4chan. Now fuck off.
hello_reddit!
>>54235437
Anonymity leads to a lack of accountability. Internet tough guys bragging about skills they don't have and lives they only dream of, basically.
>>54235462
yeah but on all the other generals i visit outside of /g/ they're perfectly fine and not elitist fucking weeb cunts
>>54231666
I got a question on hybrid vs native apps.
Why are people still writing native apps? It seems like with tools Like Cordova and phone gap the practical thing to do Would be write a hybrid app and ship everywhere at once.
So why do people still write native apps? (sorry if it's a newbie question, I'm new to programming for mobile)
>>54235286
>>nested function
>That's a GNU extension, not standard C.
what the fuck are you serious? then why don't they have it for C++ as well?
>>54235446
><quote related to employee attitudes>
><statement about the state of C>
I call non sequitur.
>>54235508
Because C++ already has its own nested functions, if I'm not mistaken.
>>54235473
results of years of telling people how precious snowflakes programmers are
Hey /g/ how do I assess my code?
I've made some shitty AJAX website with 0 planning and I can only assume it's sloppy and inefficient as shit.
What should I be looking out for? Do I just go line by line closely investigating what it does & how I can optimize it?
Thanks
>>54235473
Because the software field is young and many of us are self-taught, sometimes via shitty websites made by smartasses that dumb everyone down.
>>54235579
why would that make people a cunt?
>>54235524
Not really. Since C++11 it has lambdas, but not nested functions.
>People complaining about people on 4chan being assholes
I think you should leave.
>>54235613
this
i think conventional style nested functions would be neat for when you have some utility function that only gets used within another function, so you can stow it away in the top of that function
>>54235586
When everyone is misinformed and thinks everyone who knows differently is wrong, egos and arguments are bound to appear.
>>54235651
Interesting. It always frustrated me how everyone knows roughly the same thing but when they try to talk to each other it it looks as if they were talking about something completely different.
>>54235017
Codeblocks, mingw version. Just werks.
>>54235094
how the fuck is this different from normal CPU
>>54235500
No lags
>>54235646
I'm convinced this is an angry normie attempting a false flag.
>>54235500
The "hybrid" technologies come with performance penalty.
>>54235500
Because:
>better performance
>native API is always more mature, stable and complete
>one dependency less
/dpt/ is it normal to think you 'can do nothing'?
Like, I got a project in uni, thought "holy fuck this is impossible I have no idea what to do" - and then I was done in under half the time we had for it.
Okay, as I'm studying EE it was electronics and programming, not just plain programming, but still.
I always get this hopeless feeling that I have no idea what to do, but then it easily works out - very fast even. Normal?
>>54235730
xie xie
but I think I will try VS
in the past I used notepad and DJGPP
>>54235742
> in this architecture your processor can only handle one instruction - MOVE
>>54235765
instead of thinking "this looks complicated" when you get the project you should think "which of my knowledge does apply here? where do i look to learn about the missing parts?"
>>54235765
Google 'software estimates'.
Yes, it's normal. Try breaking it down.
>>54235500
because webshit like cordova and phone gap suck fucking ass, gives a low quality product with terrible performance and battery drain, and they tend to have bigger filesizes and have more bugs
especially for games and multimedia you need good performance
>>54235500
>Why are people still writing native apps?
For the sake of simplicity, there's three development camps:
>'BFC' big fucking company (twitter, facebook, etc.)
>small to mid-size company, as well as internal applications
>individual fartbox devs
BFC has the resources to write a native application for each platform. Web, Android, iOS, WP(maybe), etc.
Individual fartbox only knows Swift or Java and so deploys to one of these two things, as they haven't had enough experience to play with hybrid tools, or their copy/pasted code from their college class doesn't fit the basic MVC layout.
Small/Mid companies, ESPECIALLY for internal applications, are using hybrid deployment. I personally maintain one for the company I work for, as well as a few clients. Xamarin makes it pretty damn easy, as I already was familiar with C#.
>>54235500
>>54235795
and if you know what you're doing you can write "native" code that you can very easily port to any platform
>>54235781
>>54235786
As I said, the solving's not the problem. It ends up going "ah, I can try this, oh, then this, then that" and suddenly everything's done, when I think I'm still far from the goal.
Suddenly this feeling of "lel it's done" sets in.
So I'll just take that as a "yes, it's normal".
>>54235742
None of this:
http://ref.x86asm.net/geek.html
>>54235500
Try writing anything more than a "Hello world" app in a hybrid framework of choice and you'll know.
>>54235803
>small to mid-size company
You mean an SME, right?
>>54235500
>>54235795
also dynamically typed shitter languages like javascript ARE COMPLETE FUCKING SHIT and you can only make very simple shitter apps with them
>>54235837
Atom? VSCode? Duelyst?
>>54235807
>As I said, the solving's not the problem.
Yes, hence 'break it down'. If you can't estimate the build time of a cathedral, start by estimating the build time of the walls, windows, tower etc.
>>54235857
kill yourself
>>54235837
Well, JS is shit, but it's certainly not only used for 'simple shitter apps' as you so eloquently put it.
>>54235865
mad because I've proven you wrong?
>>54235872
yes it is
>>54235876
they are not mobile apps and they're shitty and irrelevant
>>54235825
>SME
>small to mid-size enterprise
I fail to see the distinction, but yes. My company and clients range from 40 to ~200 end-users.
>>54235899
certainly more relevant than your fizzbuzz in ansi c
What's some good programming food?
>>54235911
kill yourself and fuck off to >>>/g/wdg literal fag
>>54235913
your mom
>>54235913
Soup. No, seriously. It fills you with warmth, energy and water, yet at the same time you don't feel oversatiated.
>>54235913
Quiche and coffee.
Strawberries and tomatoes with balsamic if you've got it.
>>54235927
look at this poorfag
>>54235837
>ARE COMPLETE FUCKING SHIT and you can only make very simple shitter apps with them
COBOL is shit, and yet our banking systems rely on it. C is unsafe, and yet it's the lingua franca of programming. CPAN has one of the most extensive collection of libraries, and Perl is so ubiquitous, it comes preinstalled on many popular Linux distros. Stop peddling this 'you need a perfect language to get anything done' nonsense.
>I need $10000 shoes to jog, otherwise I'm doing it wrong wahwahwah
>>54235986
good luck with your js cordova flappy bird clone babby shit lmfao
FRIENDLY REMINDER!
Anon, your favorite language is probably really great for many different applications!
Keep learning it and become an expert!
There are great jobs in every programming language!
Don't give up!
Support your fellow anons' endeavors to gain currency with their favorite language!
Except Haskell fags. Fuck those guys.
>>54236012
>lmfao
*sigh* Good luck reaching the 7th grade to you too.
>>54235837
i can make a fucking app in 10 seconds with javascript on a computer that has zero coding tools installed
meanwhile, you suck dick
>>54235667
>deleted
>>54235646
>not deleted
literally kill yourself trap fag/fuck off false flagger
>>54236050
fucking idiot
>>54236053
cool app ahmed
>>54236034
>There are great jobs in every programming language!
Where? Where can I find a job using, say, Nim or Clojure? C++, PHP, ASP.NET, Python, Java, these are what's sought. Employers are afraid that betting on an unpopular language will shrink their talent pool.
>>54236121
There are nearly 600 jobs alone on LinkedIn for those languages!
And you're like one of 7 people that know those languages!
Free job!
Don't give up!
>>54236085
So why are you so sad and angry? No friends? Laughed at by girls? Mom left you with an alcoholic dad? Ugly from birth? Cerebral palsy? Sole Trump voter of your entire slum?
>>54236184
>projecting this hard
you're clearly the one who's angry lmfao
>>54236147
Except they all expect relocation, working primarily with something other than what they advertise, are looking for seniors and leads, work in an area that is of no personal interest, expect 60h work weeks or just don't provide adequate pay.
Still, I appreciate the thought.
>>54236279
Relocation is a good thing, from my standpoint.
I'm single with a cat, though. Nothing tying me down.
I get bored, so new scenery is fun.
>>54236300
>single
>cat
>nothing is tying me down
>>54236246
Well if you don't tell me what's wrong, I can only assume. Either way, I'm happy to give you the attention you need. Just to let you know, all things come to an end, including bad ones. Just hang in there.
>>54236324
Maybe I'm just autism, but I don't understand the intent of your post.
>>54236335
Relocating a cat isn't very fun for the cat.
>>54236147
>Recruiters Central
Scum of the earth.
I'm thinking of building myself a Decision Jungle AI that presents me with the few threads on /g/ that are not utter shit like /dpt/.
I'd like to train using a modified ID3 that me and a friend created as a research project in college.
Question is, what are some good metrics?
I figured:
- number of posts
- posting intensity
- top~20 word counts
Now maybe I should change word counts to some metric that takes number of posts into account, but then 'frequency of word x per post' or 'number of posts that contain word x' are both candidates and I can't really think of why one would be better.
Any thoughts /g/?
>>54236121
There are plenty startups that like Clojure and allow for working remotely. Expect shit pay and chaotic organisation, but if you adapt a bit the work atmosphere can be pretty chill.
>>54236325
kill yourself sperg
>>54236344
He'll be alright, I'm sure.
He's like 10, and has moved many times in his life. He adjusts like a champ.
I love my cat, but he won't get in the way of me having a better life.
Same goes for the last girl that was in the picture.
>>54236335
You are in a relationship with your cat, and your cat is tying you down. That's what it means to be a single adult living with a cat.
>>54236348
That's good, let it all out. Btw, I don't know for how long I'll be here, so here's something for when you're alone again: http://www.simplyconfess.com/
>>54235317
>C is much better.
what c has that c++ has not ?
>>54236462
Cleanliness and properly designed.
>>54235317
>wahh C++ is so scary with all these things that are new to me and that i'm too afraid and too stupid to learn about
>>54236483
bullshit
>>54236483
C is shitty as hell ffs stupid babby sperg
>>54236483
lel, c is a shame to any pl theorist
>>54236462
Variable length arrays.
Compound literals.
Designated initialisers.
restrict pointers.
The absence of many horrible features.
Clean syntax.
Those are the things which pop to mind for which C++ doesn't have an equivalent. I may be missing some stuff though.
>>54236483
http://www.itworld.com/article/2918583/open-source-tools/c-leads-the-way-in-ugly-hacks.html
definitely clean and properly designed
>>54236485
>>54236491
newfags leave
>>54235317
Bloated in what way? Compile times used to be a problem, but these days computers are pretty fast, as long as best practice is followed (pimpl when advisable, forward declarations etc.)
>>54236462
>what c has that c++ has not ?
Control over what you do.
>>54236518
Too many features.
Too much duplicated functionality.
No obvious 'focus' in the language, for which features are compared against.
>>54236511
>variable length arrays
you want a vector, arrays should have static length
>compound literals
has it
>designated initialiser
can be done with constructors
>restrict pointers
write a wrapper class
>absence of many horrible features
yes, absence of many features
>clean syntax
C++ has clean syntax, it also has ugly syntax for doing things that can't be done in C anyway
>>54236513
>http://www.itworld.com/article/2918583/open-source-tools/c-leads-the-way-in-ugly-hacks.html
You're confusing everything. Dirty and ugly hack are present everywhere, but non C developers don't recognize thema as dirty and evil hack. But C developers who are used to cleanliness of C see that it's dirty.
I talk a lot with C++ and they never see why everything is awful in their language. Try to explain them why moving semantics is a dirty hack because of the design choice to call copy constructor for everything.
>>54236548
>C++ has clean syntax, it also has ugly syntax for doing things that can't be done in C anyway
Such as ?.
>>54236533
What can't you control in C++ that you can control in C?
>>54236511
>Variable length arrays.
vectors
>Compound literals.
initializer list braces
>restrict pointers.
supported in C++ by GCC and MSVC
>The absence of many horrible features.
on the other hand there's absence of any useful features in C
>Clean syntax.
subjective
>>54236513
I'd definitely like to see the face of these ugly hacks. At least, many C hackers know when they are doing ugly hacks. I don't think I could say the same for many so-called experts in other languages.
>>54236562
Templates, operator overloading, function overloading, namespaces, references, alias types, .member syntax
>>54236548
>you want a vector, arrays should have static length
That's a completely different thing, idiot.
>has it
Only as a non-standard extension
>can be done with constructors
Not the same thing.
>write a wrapper class
What? Do your even know what a restrict pointer is?
>yes, absence of many features
more features != better
>C++ has clean syntax
auto int_ms = std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1);
>>54236511
wow, such features.
>>54236511
>Variable length arrays.
c++14 has them and std::array
>>54236542
>Too many features.
Agreed
>Too much duplicated functionality.
Not really.
>No obvious 'focus' in the language, for which features are compared against.
It focuses on more than one thing, and that's a good thing. There's nothing worse than using a crippled piece of crap like Go, where any attempt at abstraction leads to a total mess, followed by failure.
>>54236579
>i can't get a grasp of something so i'll call it useless and bloat
cute
>>54236582
>
If you want to allocate a runtime amount of memory, you should not be using an array. The size of an array is part of the type.
>
No, initializer braces are standard
>
But can still be done, and with a clean interface.
>
You can write a class to wrap a pointer, not expose the pointer, and provide a variety of methods elsewhere for dealing with optimised instances of that class.
>
less features != better
>
using namespace std::chrono;
auto int_ms = duration_cast<milliseconds>(t2 - t1)
>>54236586
>std::array
My quick search in http://en.cppreference.com/w/cpp/container/array leads me to believe that they are not VLAs.
>>54236617
What the fuck are you talking about?
>>54236619
Yeah they aren't, they're just more type safe arrays. He doesn't know what he's talking about.
>>54236562
Abstraction.
Able to do computation in the static environment.
A better type system.
Lambda expression.
Generic programming
RAII
>>54235927
it fills you with determination
>>54236618
>If you want to allocate a runtime amount of memory, you should not be using an array. The size of an array is part of the type.
Why not? I will be enjoying my stack allocated variables while you use your vectors to allocate a few bytes on the heap.
>No, initializer braces are standard
See image. That's what I mean by compound literals.
>But can still be done, and with a clean interface.
Show me how you would doint arr[] = {
[10] = 5,
[500] = 3,
};
with a constructor.
>You can write a class to wrap a pointer, not expose the pointer, and provide a variety of methods elsewhere for dealing with optimised instances of that class.
What on earth does that have to do with aliasing?
>less features != better
It does in some cases. C is a very focused language and it's lack of unnecessary features is a selling point.
>>54236553
>non C developers don't recognize thema as dirty and evil hack
[citation needed]
>C developers who are used to cleanliness of C
Haskell is clean. Scheme is clean. C is not.
>the design choice to call copy constructor for everything.
I agree that C++'s special functions are retarded, but move semantics isn't about copy ctors, and it's a fairly clean feature compared with some of the other stuff in C++.
>>54236661
>Show me how you would do [...] with a constructor.
Genuinely curious, does that leave the other array elements as uninitialized memory?
>>54236697
>>non C developers don't recognize thema as dirty and evil hack
>[citation needed]
>move semantics isn't about copy ctors, and it's a fairly clean feature compared
You just insert the needed citation.
>>54236711
It initialises them to zero.
Does anyone have an image of programming challenges? None of that 'sum of A + B' stuff.
>>54236722
'give the product of A and B'
>>54236722
http://better-dpt-roll.github.io/
>>54236618
>If you want to allocate a runtime amount of memory, you should not be using an array. The size of an array is part of the type.
I'm a C++ fag, and even I think you went full retard here. I'd go with C++ over C any day, but C definitely has some nice stuff, like VLAs.
>>54236661
Tbh the language should allow you to stack allocate if available without needing that sort of thing. You can use a std::array with the maximum possible size and then track the current size.
>
I don't get what you mean. How does this differ from
std::array<int, 3> { 0, 1, 2 }
or similar
or
something { {3, 4}, { 5, {7, {8, 9 } } } }
>
template <typename At, typename Is, typename ... T>
arr(At Ind, Is Val, T... rest) : arr(rest...) { member[Ind] = Val; }
arr(3,"str", 7, "asdf", ...)
obviously using pairs would be better
>
nvm
>
It's lack of features is also a reason people avoid it
>>54236748
A VLA is literally a vector. The difference with C++ is just that sometimes it's put on a stack, and it has a nicer syntax.
>>54236661
>Why not? I will be enjoying my stack allocated variables while you use your vectors to allocate a few bytes on the heap.
But you can pass a custom allocator to a vector and make it allocate on the stack?
>>54236779
>A VLA is literally a vector.
>>54232951
Oh yeah. The char thing was honestly just my mistake in the mockup. Wasn't even paying attention.
Anyways, I'll be sure to do so and see if that fixes my issues. Cheers anon.
>>54236748
>VLA
>nice stuff
Spotted the std::vector fag here.
If there's one thing that is quite dirty in C, it's VLAs. Being a runtime feature, they do not permit a deterministic behavior where needed. Of course, you're not obliged to use them, but they're mandatory in the C99 standard, thus making C99 not really the standard of choice in critical systems. No wonder VLAs are no longer mandatory in C11.
>>54236779
>A VLA is literally a vector
A VLA is not resizeable. It's just that the size of the array at declaration doesn't have to be static.void fn(int n) {
int arr[n];
}
It's very efficient and there is no wasted space by over-allocating. However, you have to make sure n isn't too large (e.g. if from untrusted input) as you can overflow the stack.
>>54236766
>How does this differ from ...
It can be used inside expressions.
>template <typename At, typename Is, typename ... T> ...
That's not clean at all. I should have also demonstrated another thing about designated initialisers which your template probably doesn't handle.int arr[] = {
[10] = 1, 2,
};
//arr[11] == 2int arr[] = {
[10] = 1,
[8] = 2, 3, 4,
};
//arr[10] == 4
>>54236713
1. Anecdotes aren't worthy citations. "This guy I met" isn't proper research.
2. Learn what 'compared' means. I know that moves are hacky, but there are worse offenders, so my point was that you gave a lazy example of hackiness.
I'll be waiting for a proper citation.
>>54236812
Explain the difference, in the context of what I said
>>54236819
Before VLAs you could use alloca. Nothing has changed.
>>54236838
>Explain the difference
Not resizable, and therefore, not like Vector.
>>54236779
You're literally retarded. 5 posts later and you still can't be assed to look up the workings and use cases for VLAs.
>>54236819
Just validate your damn inputs.
VLAs can be 'dangerous' if you overallocate. Also, memcpy can be dangerous if you give an n too big, as do a lot of library functions.
VLAs are no more dangerous that most things in C.
>>54236829
C++ has new[] for that
>>54236829
So can an initialiser list
>>54236829
It could be cleaner, as I said.
It could be as clean as
10M = 1, 8M = {2,3,4}
>>54236846
>>54236856
>variable length
>not variable length
You're right, if only I took C's clean syntax and obvious terminology seriously.
>>54236819
>deterministic
Do you even know what that means?
>>54236859
>new[]
not on the stack
>>54236859
>C++ has new[] for that
That is a much more expensive allocation that just making room on the stack. I don't want to incur a heap allocation for a 10 character string or some shit.
>>54236871
'resizeable' is the term you're looking for, idiot.
The size of the array is variable. It may or may not be the same each time it's declared.
New thread >>54236901
>>54236890
>>54236891
Which I mentioned before
Always nice of C programmers to be arguing for less portable features though
>>54236871
The length is variable at declaration time, but it's not resizable.
>>54236909
No, dynamic is the word I'm looking for. The size of the array is dynamic and not static.
here you go memesters
https://chromium.googlesource.com/chromium/chromium/+/master/base/stack_container.h
>>54236916
>>54236916
/!\ nu thread /!\
>>54236871
>std::move
>not a move, but a cast
You're right, if only I took C++'s clean syntax and obvious terminology seriously.
How about you stop acting like a dumbass? No one in their right mind would act like they understand a language feature after only hearing the name for it. VLAs are VL because their Ls are based on run-time Vs.
>>54236923
>variable at declaration time
In other words, not variable, just dynamic.
The C++ standard doesn't even specify how new allocates, it just says it has dynamic storage duration (like a VLA)
>>54236948
this, and it would be called a resizable array if it were resizable fucking retards
>>54236948
I did look it up, I didn't spend 5 minutes reading about it.
std::move does move
>>54236971
>variable length
>variable
>vary
Yeah, if only.
>>54236912
>stack
>less portable
Your lazy sarcasm falls flat.
>>54236988
Yeah, it does vary you fuckwit.
You're just arguing retarded semantics. Who said it had to vary over the lifetime of the object?
>>54236959
VLAs have automatic duration. For how long are you going to continue embarrasing yourself?
>>54236975
It casts to an rvalue, you mongoloid. The move occurs subsequently:
http://en.cppreference.com/w/cpp/utility/move
>>54237027
Yeah, but the C++ standard never says you can't allocate stack space dynamically. It'd be pretty dumb, but it's still valid.
>>54236988
>const variable
>variable
>vary
kill yourself FUCKING SPERG
and it does vary, the array can be different in size, it's not known at compile time
KILL YOURSELF I HATE YOUR GUTS FUCKING RETARD
>>54237067
Yeah, the move is done in the operator=, but the casting to an && is part of the move.
The cast might even have an effect, like a lock.
>no C buddy to help me learn
>>54237071
That's not the point. VLAs are nowhere defined as being dynamically allocated, as you claim, so you can't say shit like
>it has dynamic storage duration (like a VLA)
>>54237169
Learn Rust instead, your users will be thankful.
>>54237169
Go skim over the standard or some shit. I learned all sorts of obscure C things by doing that.
>>54237172
I didn't say that, I said it's size is dynamic like a VLA.
>>54237270
There are all sorts of VLA semantics that C++ new[] doesn't have.
By your logic, it's just as useful to say malloc is a VLA.
>>54236890
nothing says that c's vla are allocated on stack
>>54237313
Yeah, I agree there are differences between a VLA and a vector. Is there anything else C++ is lacking?
>>54237336
C is pig disgusting confirmed yet again
>>54237336
>>54237357
>nothing says that c's vla are allocated on stack
VLAs have automatic storage. That's all that is important. The abstract C machine doesn't even mention a stack.
However, on every real implementation, it would be allocated on the runtime stack.
>>54237366
>However, on every real implementation, it would be allocated on the runtime stack.
it better be
any thing else would be fucking shit for a "low level" lang
Can anyone explain pic related to me? Not necessarily show me the solution, just walk me through it.