• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

I thought there was a way to identify the number of elements in a C array through the application of sizeof. It's one of the few instances where there's a difference when defining a a variable as an array type instead of as a pointer.

Something like

Code:
int a[5];
printf("a has %d elementsn", sizeof(a) / sizeof(a[0]));

Just an academic question. In practice you're usually either going to dynamically allocate arrays into a pointer variable or set the array size using a constant, which you can just reuse.

At the lowest level, an array is not even a thing in c++ (ignoring std::array for the sake of this discussion). Blocks of memory are a thing though. What you've got there is a block of memory of either 20 or 40 bytes depending on your platform. The rest is syntactic sugar to help the compiler figure out how to interpret the bytes.

So in one sense, ok you can think of it as an array of 5 ints. But if I write this:

Code:
void foo(int *array)
{
}
 int main(int argc, char **argv)
{
    int a[5];
    foo(a);
}

Inside the body of foo, there's no way to know how "big" this array is. Because an array is just a pointer.

By convention, people frequently treat these statically allocated arrays as being of a constant size, and using the technique you just demonstrated to determine its size.

But in CornBurrito's post, he wanted to know specifically how to "change the size". And my point is just: The size is what you say it is, as long as there is enough memory.

If it had 5 elements and you want it to have 4 elements, just start telling people who use it that it has 4 elements. Done.

If it has 4 elements and you want it to have 5, tell people it has 5 (as long as its buffer is large enough to actually hold 5 values)

In his example where he said he didn't know what to do about the last item in the list, the answer is: it doesn't matter. Because you're going to tell people the list has 4 items, and so they won't even bother to look at the 5th.
 
But in CornBurrito's post, he wanted to know specifically how to "change the size". And my point is just: The size is what you say it is, as long as there is enough memory.

This. There is the realloc method for changing the size of an allocated region of memory (so long as it was created on the heap via an allocation method; you can't realloc things on the stack safely), but that's fairly slow and requires moving everything after the deleted element forward in the array before reallocation (as CornBurrito already pointed out, this is fairly ugly to implement).

For the problem CornBurrito is describing, I'd likely use a linked list with each element containing an integer, if allowed. Then you have a fairly straightforward deletion operation that only frees up memory and doesn't require moving elements around.

Just to soapbox a little, I kind of cringe when I hear about programmers who Google their specific problems and copy-paste solutions all the time from places like Stack Overflow. I do the same thing but I'll never just take the solution that someone posted and apply it to my own code; I'll use it to guide me to the relevant section of the official documentation. You never know if some code you find on the internet is truly the best solution or doesn't have edge failure cases unless you completely understand how it works.
SO posts can be extremely helpful when you first want to understand a concept. I agree that Googling and applying an answer without reading into it at all is never the way to go, but you can get a pretty surprising amount of information from a single SO post if you read everything posted (especially the comments) and follow up on the various sources/links that people place in their answers. I've gotten some surprisingly well written code snippets from there before, and cited them in my solutions with reasoning for why the solution given is applicable to the problem at hand. I agree about following up on official documentation- knowing your edge cases is essential to good programming.
 
This. There is the realloc method for changing the size of an allocated region of memory (so long as it was created on the heap via an allocation method; you can't realloc things on the stack safely), but that's fairly slow and requires moving everything after the deleted element forward in the array before reallocation (as CornBurrito already pointed out, this is fairly ugly to implement).

For the problem CornBurrito is describing, I'd likely use a linked list with each element containing an integer, if allowed. Then you have a fairly straightforward deletion operation that only frees up memory and doesn't require moving elements around.
Umm.. Please don't use realloc. He just wants to shift some elements down in an array. Don't make this more complicated than it needs to be. And a linked list for 5 elements? Sorry, but that's a pretty terrible use of a linked list.

This problem is simple: Shift the stuff down, tell users it has 4 elements. He's jsut trying to understand how C-style array syntax and pointers work. Here's 2 ways to do it:

Code:
void remove_item(int *array, int item, int len)
{
    assert(len>0 && item < len);
    for (int i=item; i < len-1; ++i)
        array[i] = array[i+1];
}

void remove_item(int *array, int item, int len)
{
    assert(len>0 && item < len);
    ::memmove(array+item, array+item+1, len-item-1);
}

This is the exact reason why classes like std::vector and other array-like classes store the length (or a pointer to the end so the length can be computed), so that you can resizse.
 

Nelo Ice

Banned
So anyone have advice on a resume?. Cuz looks like I should start applying to dev jobs. And to note I have no degree but I'm self taught and completely driven. I still consider myself a complete beginner and don't have any completed projects on my own. Unless you count what little code I've helped with on Hackathons and I've won prizes at one.

Anyway only reason I'm even working on my resume now is I've been told I'm already know enough for a dev job even though I've only seriously been learning since July. Anyway I've personally met the founders of FreeCodeCamp and they told me I should start applying. Then I went to a Google Talk and got to speak with one of the panelists. She said the same thing. And this is after outlining how little I knew and basically trying to convince them no I'm stupid and not ready lol.

It sounded like a pipe dream that anyone would even consider hiring me and for that matter I thought I knew jack shit to land a job. So I didn't believe the FCC guys at first but it took that 3rd endorsement from Google to make me believe ok maybe I should start applying. The Google employee told me startups and some bigger companies would take me on as a beginner. Apparently I would learn on the job and they would essentially build me up. But yeah if there's any templates I should follow or what things I should list or emphasize that would be awesome. And not gonna lie still unsure if I should even be trying. But figured if 3 people I hold in high regard think I can do it then I may as well try rather than go back to the service industry I loathe.

edit: Well just talked to a dev friend and was told should go for the home run and try for a dev job. But at the same time try and get job I can realistically get now like retail, service etc that hopefully pays above min wage. Since yeah in the back of my mind getting a dev job at this time still sounds like a pipe dream.
 

BakedYams

Slayer of Combofiends
So my issue is the quote below.

Is anyone here fluent in C++? I'm trying to run compile it in the command prompt, which has worked so far (using MinGW), but I need certain libraries to be in the folder where the .exe is and I already added the bin folder to my PATH to make it compile off of the command prompt. I don't want to copy a bunch of .dll's to a folder with .exe's every time. I looked it up and I can make static libraries but I have no clue how to do it since the commands don't exist for me ;_;

The generous Joule gave me a great response.

Not certain I'm correct here but let me give it this a try. I'm assuming you're using gcc? It's been awhile but couldn't you use something like the -L and -l flags to specify the path to the libraries with the former and the name of the library with the latter.

eg. gcc hello.c -L /somewhere/here/mylibs -l libA

But really you should put this question in the programming thread on gaf.

However, the answer requires a little too much work compared to what I do with the java compiler and sublime note 2. Additionally, I use MinGW. A recommendation online was to somehow make the dll's static, which I have no clue what that means. I just want to be able to run my code in C++ without having to move around my library and my exe files just take from the bin without my involvement in any way.
 
Any particular reason you're tied to MinGW?

Edit: to attempt to answer your question, are you compiling these libraries, or are they precompiled for you?
 
Umm.. Please don't use realloc. He just wants to shift some elements down in an array. Don't make this more complicated than it needs to be. And a linked list for 5 elements? Sorry, but that's a pretty terrible use of a linked list.
[
I agree, you never want to realloc something smaller, especially for this many elements; I was just presenting it as a method to how he could actually resize the amount of memory (and thus number of available entries) allocated to the array. He will need to use it if he runs out of room in the initial array in order to expand it though, so it's useful to know about depending on how far he's going with this problem in the future.

And I don't think linked lists are complicated at all, and are great when you have something that deletes elements frequently with even a moderate number of entries. Sure, it's roughly equivalent for something with only 5 elements, but it's important to know that it's much slower to collapse everything in a traditional array when even some amount of deletion operations are being performed on it. I work with the Linux kernel a lot though (especially the networking stack), so I'm biased towards linked lists.

So anyone have advice on a resume?. Cuz looks like I should start applying to dev jobs. And to note I have no degree but I'm self taught and completely driven. I still consider myself a complete beginner and don't have any completed projects on my own. Unless you count what little code I've helped with on Hackathons and I've won prizes at one.
As far as the actual resume goes, the #1 tip I always got from recruiters is that the resume should only be one page, and you obviously want to put the more important stuff (previous experience, projects implemented, etc) at the top. Not much to go on, but I'm not the strongest resume builder either (I went into grad school, so yeah...). It sounds like you've definitely got stuff to talk about though- even if you've only worked a bit on projects at Hackathons, it's still a resume topic (especially if you won an award!). If you don't feel entirely confident in what you've got, I'd recommend implementing some side project on your own before applying, particularly in the area of the company you want to apply for. It'll give you more experience, another resume point, and you'll have actively been thinking about code before going into a potential interview.
 

Slavik81

Member
And I don't think linked lists are complicated at all, and are great when you have something that deletes elements frequently with even a moderate number of entries. Sure, it's roughly equivalent for something with only 5 elements, but it's important to know that it's much slower to collapse everything in a traditional array when even some amount of deletion operations are being performed on it. I work with the Linux kernel a lot though (especially the networking stack), so I'm biased towards linked lists.
It's only slow to remove from an array if you have a large array and must maintain order. Even then, if you have to search for the item in the linked list to remove it, the array may still be faster.
 

Nelo Ice

Banned
As far as the actual resume goes, the #1 tip I always got from recruiters is that the resume should only be one page, and you obviously want to put the more important stuff (previous experience, projects implemented, etc) at the top. Not much to go on, but I'm not the strongest resume builder either (I went into grad school, so yeah...). It sounds like you've definitely got stuff to talk about though- even if you've only worked a bit on projects at Hackathons, it's still a resume topic (especially if you won an award!). If you don't feel entirely confident in what you've got, I'd recommend implementing some side project on your own before applying, particularly in the area of the company you want to apply for. It'll give you more experience, another resume point, and you'll have actively been thinking about code before going into a potential interview.

Thanks for the advice!. Yeah one of the FCC guys mentioned having been part of a winning Hackathaon team was huge. And atm I figured if really am gonna try and apply I should at least finish the portfolio site I'm reverse engineering from FCC. Besides that I already know I'll fail on answering programming questions and any tech tests. I was also telling people that and they still thought I could get a job lol. Also mentioned in another thread I've managed to convince alot of people I'll be hireable in the future. But apparently I'm somehow ready now.
 

Slavik81

Member
weird2.png


I'm getting mystery shadows :( I thought it may be todo with colors overflowing as (at the moment) I am using an unsigned byte to represent each color channel. However, I did add code to check for that so that doesn't seem to be the issue. The only problem is that I really don't know what it could be.

Code:
 static uint8 addChannels(uint8 c1, uint8 c2) {
      if((c1 | c2) == 255) {
            c1 = 255;
        } else {
            uint8 newC = c1 + c2;
            if(newC < (c1 | c2)) {
                //Have overflow, max out color!
                c1 = 255;
            } else {
                c1 = newC;
            }
        }
        return c1;
    }

Here is all the code: https://github.com/Moosichu/RayTracer/blob/master/src/ray_tracer.cpp

Ignore the really bad project structure and bad code style. I am improving things bit by bit! I just want to sort all the bugs first :p.
I'm kinda finding it difficult to understand your overflow check. Why not just cast to 32-bit integers, do the addition, check if it's greater than 255, then convert back to uint8?

Edit: I get it now. Seems ok...
 
It's only slow to remove from an array if you have a large array and must maintain order. Even then, if you have to search for the item in the linked list to remove it, the array may still be faster.

True, this does only matter with larger arrays, which is why I said that with 5 elements it's roughly equivalent. However, the example given seemed to both require ordering and searching for an element in the array rather than being given an index to remove, hence why I would rather use a linked list. If ordering isn't required, then it's much easier to just move whatever's at the end into the empty slot instead with a traditional array.

Thanks for the advice!. Yeah one of the FCC guys mentioned having been part of a winning Hackathaon team was huge. And atm I figured if really am gonna try and apply I should at least finish the portfolio site I'm reverse engineering from FCC. Besides that I already know I'll fail on answering programming questions and any tech tests. I was also telling people that and they still thought I could get a job lol. Also mentioned in another thread I've managed to convince alot of people I'll be hireable in the future. But apparently I'm somehow ready now.
People usually frown on this, but if you're not feeling prepared for interview questions you can go on GlassDoor and see what sorts of questions the company you're applying to (and similar companies) ask. On a more intense front, there's tons of books out there that will help you prep for coding interviews. I was recommended Cracking the Coding Interview at one point, but I've never taken a look at it myself.
 
I agree, you never want to realloc something smaller, especially for this many elements; I was just presenting it as a method to how he could actually resize the amount of memory (and thus number of available entries) allocated to the array. He will need to use it if he runs out of room in the initial array in order to expand it though, so it's useful to know about depending on how far he's going with this problem in the future.
Unless you're programming strictly in C, I don't think it's very useful. Because practically you're going to use std::vector in that case. I mean sure, there are cases where you really need to implement your own memory management, but I consider that a fairly advanced use case.

And I don't think linked lists are complicated at all, and are great when you have something that deletes elements frequently with even a moderate number of entries. Sure, it's roughly equivalent for something with only 5 elements, but it's important to know that it's much slower to collapse everything in a traditional array when even some amount of deletion operations are being performed on it. I work with the Linux kernel a lot though (especially the networking stack), so I'm biased towards linked lists.

I'm not saying they're complicated. I'm just saying the poster is trying to understand how memory management and pointers work, not choose the optimal data structure for some algorithm.
 
Unless you're programming strictly in C, I don't think it's very useful. Because practically you're going to use std::vector in that case. I mean sure, there are cases where you really need to implement your own memory management, but I consider that a fairly advanced use case.

I'm not saying they're complicated. I'm just saying the poster is trying to understand how memory management and pointers work, not choose the optimal data structure for some algorithm.

Both good points. I like I said, I'm a Linux kernel person at heart, so I'm all about that C life, which is likely where the differences in my opinion come from here. Certainly when first understanding memory management/pointers a basic array is the way to go, but I assumed he had some knowledge of that already before attempting to create an array implementation.
 

Nelo Ice

Banned
People usually frown on this, but if you're not feeling prepared for interview questions you can go on GlassDoor and see what sorts of questions the company you're applying to (and similar companies) ask. On a more intense front, there's tons of books out there that will help you prep for coding interviews. I was recommended Cracking the Coding Interview at one point, but I've never taken a look at it myself.

I'm nowhere near the level to answer questions from that book lol. So again I still have no idea why I've been told I should apply since right now I feel like my issue is I don't have the tech skills/experience but I do have the people skills. Though yeah I've heard it' a great book so I imagine I'll need it once I actually become competent. Like one of the Google engineers at the talk I went to mentioned it took him 5 tries to get into Google and he studied all day with that book in prep for his last interview that finally got him the job.
 
I'm nowhere near the level to answer questions from that book lol. So again I still have no idea why I've been told I should apply since right now I feel like my issue is I don't have the tech skills/experience but I do have the people skills. Though yeah I've heard it' a great book so I imagine I'll need it once I actually become competent. Like one of the Google engineers at the talk I went to mentioned it took him 5 tries to get into Google and he studied all day with that book in prep for his last interview that finally got him the job.

How can you have the skills/experience without ever having had a job?

That's why it's called entry level. They're not looking forward the same level of skills and experience
 

Nelo Ice

Banned
How can you have the skills/experience without ever having had a job?

That's why it's called entry level. They're not looking forward the same level of skills and experience
Ahh well that makes me feel better. I just assumed I would have had to build up a portfolio and work on open source projects to even be considered. Since yeah I thought it was a pipe dream for a company to hire someone at my level.

But hey guess I may be wrong since it seems I may be able to get by on pure drive and enthusiasm for learning. Just never thought that would translate into a job so soon since that's basically what I've demonstrated when I've networked with people. People have told me they're excited to see my career but I honestly never thought it could potentially start now since I was thinking spring next year at earliest. But again also been told I know more than I think I do so maybe I am self deprecating a tad too much lol.
 
A raw C array has no size. It's size is whatever you know it to be. Whether you "know" correctly or not is a different story. If you have this:

int* GAF;

How many elements are in the array? Who knows! What about this:

int * GAF = new int[5];

How many elements are there now? Still don't know. We only know that there are at most 5. But there could be less than 5. It just all depends how you use it. That's why you don't write this:

Code:
for (int i=0; i < 5; ++i)
    printf("%d", GAF[i]);

Instead you write this:

Code:
for (int i=0; i < len; ++i)
    printf("%d", GAF[i]);

If len==4, you're saying that this array has 4 elements. If len==5, you're saying it has 5 elements. Back to your original example, if you want to remove one item. Do what you said. shift everything down, or use a for loop to copy the values. Then set len==4, and use that variable in any loops or anything that needs to know how many items are in the array.

Thank you very much. I can't believe I overlooked such a simple solution.
 
Ahh well that makes me feel better. I just assumed I would have had to build up a portfolio and work on open source projects to even be considered. Since yeah I thought it was a pipe dream for a company to hire someone at my level.

But hey guess I may be wrong since it seems I may be able to get by on pure drive and enthusiasm for learning. Just never thought that would translate into a job so soon since that's basically what I've demonstrated when I've networked with people. People have told me they're excited to see my career but I honestly never thought it could potentially start now since I was thinking spring next year at earliest. But again also been told I know more than I think I do so maybe I am self deprecating a tad too much lol.

All depends how high you set your bar. If you're applying at Google, you might want internships, a high gpa from a good school, and recommendations. On the opposite extreme, you can find someone who will take the cheapest person they can find, doesn't matter. And there's everything in between.
 

Nelo Ice

Banned
All depends how high you set your bar. If you're applying at Google, you might want internships, a high gpa from a good school, and recommendations. On the opposite extreme, you can find someone who will take the cheapest person they can find, doesn't matter. And there's everything in between.

K awesome then there is hope. Thanks for your advice. I really do appreciate it. Making feel more confident someone will take me on and I can learn, level up, and get paid for it. Like the Google panelist told me her friend got hired after only being in a bootcamp for 3 weeks.
 

BakedYams

Slayer of Combofiends
Any particular reason you're tied to MinGW?

Edit: to attempt to answer your question, are you compiling these libraries, or are they precompiled for you?

I recall reading something about a .bat file to get the environment ready for C++ but other than that, all I've done is download MinGW from the main website and edit the PATH to the bin folder of MinGW so I can compile it from the command prompt. A stackoverflow user from an old thread recommended to just copy the .dll file I needed to where my .exe was. Compiling worked completely fine beforehand without the .dll file, it was actually running the .exe that gave me issues saying it couldn't find something so I moved the .dll file into that specific folder and it worked fine. I just don't want to do this every single time I want to take in a user's input.

As to being tied, I'm completely new to this and just excited to get started on whatever I can since I have experience in python and java and would love to learn so many more languages so C++ is the start. I've heard of other stuff like bloodshed and visual studio express but I want to be able to compile my code off of my command prompt since I just use a text editor. Having so many IDE's feels like a hindrance and I just want everything to be in one place, which sublime note 2 does perfectly for me.
 

KageZero

Member
K awesome then there is hope. Thanks for your advice. I really do appreciate it. Making feel more confident someone will take me on and I can learn, level up, and get paid for it. Like the Google panelist told me her friend got hired after only being in a bootcamp for 3 weeks.

Can you tell me what technologies you know and what kind of app did you make for the winning hackaton if it's not a secrete? I want to compare what an entry level for programming is compared to the entry level they are searching here for.
 

JeTmAn81

Member
Thank you very much. I can't believe I overlooked such a simple solution.

I'd double check with whoever's running your class or whatever that this is the kind of solution they're looking for. If you misstated the problem even slightly then this solution might not be want they want. For instance, if the problem was with char arrays instead of integers it might be possible to shift over the elements and write a null terminating character into the last element.
 

Nelo Ice

Banned
Can you tell me what technologies you know and what kind of app did you make for the winning hackaton if it's not a secrete? I want to compare what an entry level for programming is compared to the entry level they are searching here for.

I'm learning front end web dev. So HTML, CSS, and JavaScript. I've also learned some jquery. Of course keep in mind I really just have the syntax down and am still learning how to utilize them in a project.

Also my team didn't place in an overall winners at a hackathon but we did win sponsor prizes. The hackathon theme was to showcase apis. So we basically built a web app where a traveler would take a personality quiz. Then our app would make an itinerary from local businesses based on the results of the quiz. Basically the point of the app was to make traveling easier for people so instead of all this planing you could just take a quiz and our app would do the rest. I should also note I really only contributed to the foundation of the front end design with some css. Besides that I didn't do much coding lol. Though I can say I formed the team from people I met that weekend besides 1 friend who I met at a previous Hackathon.
 

KageZero

Member
I'm learning front end web dev. So HTML, CSS, and JavaScript. I've also learned some jquery. Of course keep in mind I really just have the syntax down and am still learning how to utilize them in a project.

Also my team didn't place in an overall winners at a hackathon but we did win sponsor prizes. The hackathon theme was to showcase apis. So we basically built a web app where a traveler would take a personality quiz. Then our app would make an itinerary from local businesses based on the results of the quiz. Basically the point of the app was to make traveling easier for people so instead of all this planing you could just take a quiz and our app would do the rest.

Oh sounds nice well your not a total beginner if you'r already using api's :p. I wanted to know since i also took a part of a hackaton so i want to see how do we compare to you and looks we are not that far off. Maybe i will also be able to score a job sooner or later (i hoper the former)
 

Nelo Ice

Banned
Oh sounds nice well your not a total beginner if you'r already using api's :p. I wanted to know since i also took a part of a hackaton so i want to see how do we compare to you and looks we are not that far off. Maybe i will also be able to score a job sooner or later (i hoper the former)

Edited my post to mention what exactly I did but yeah I guess I'm not a total beginner. I honestly had no idea how they tied the apis together. But if it's any consolation we used meteor and I was at least able to comprehend and understand what the code was doing when my team showed it to me. And if I didn't I could at least understand what was happening if they explained it to me. Though I can check the repo now and see if any of the code makes sense lol.

edit: And one thing for sure I learned from the Hackathon is I got better with git and learned how to use it when working with a team. Since my previous hackathons I was mostly on standby trying to comprehend what in blue hell was going on lol.
 

BakedYams

Slayer of Combofiends
Also, can anyone recommend a slim laptop for programming? My lenovo is a bit too chunky to put in my bookbag and lug around. Plus I wanna read pdf's on the train and program at the same time.

Edit:

Possibly a laptop/tablet hybrid?
 
Anybody familiar with the different unit testing frameworks out there for C++? Catch looks nice, but I just don't know the landscape well enough. It's not like C# where there's an NUnit that's the reigning juggernaut.
 
Anybody familiar with the different unit testing frameworks out there for C++? Catch looks nice, but I just don't know the landscape well enough. It's not like C# where there's an NUnit that's the reigning juggernaut.

I like gtest, but I don't know much about others. If it's good enough for Chrome, it's good enough for me IMO
 
Edited my post to mention what exactly I did but yeah I guess I'm not a total beginner. I honestly had no idea how they tied the apis together. But if it's any consolation we used meteor and I was at least able to comprehend and understand what the code was doing when my team showed it to me. And if I didn't I could at least understand what was happening if they explained it to me. Though I can check the repo now and see if any of the code makes sense lol.

edit: And one thing for sure I learned from the Hackathon is I got better with git and learned how to use it when working with a team. Since my previous hackathons I was mostly on standby trying to comprehend what in blue hell was going on lol.

I think you're more prepared for an entry-level job than you know. You've got a lot of great selling points that make me think you'd perform well in a work environment. You'll learn a lot of new things really quickly in an entry-level job, and that's okay. What recruiters look for in entry-level positions are people that are confident, work well with a team, and are willing to push themselves out of their comfort zone to learn new things. It definitely sounds like you've got the last two; just work out some self-confidence and you'll be good to go.

Well I start my first developer job on Monday.(jr .Net) Any tips from some of the pros here?

Read the above; the number one thing I wish I had known before going into internships is that it's okay not to know things, and asking questions is okay. You won't know everything, you'll get confused, and you'll feel like you're out of your element. But the reason you were hired is because the recruiter/interviewer thought you could adapt well to a new environment and learn new concepts. No one starts off as a pro- don't try to feel like you should be one within your first week, month, or even year. I seriously overworked myself the first week of my first internship and I was burned out for the rest of the month.

If you're given a mentor/superior to answer to/ask questions in the first couple weeks/months, take full advantage of it and ask them about anything you're confused on.
Unless they end up being kind of a prick, in which case, find a nicer co-worker you can bounce questions off of.

Also, can anyone recommend a slim laptop for programming? My lenovo is a bit too chunky to put in my bookbag and lug around. Plus I wanna read pdf's on the train and program at the same time.
Before you said 'not a Lenovo', I was going to suggest a ThinkPad... that's the laptop I'm planning on replacing my current one with whenever I get tired of it. I know a lot of systems people that use one and love it. If you're looking for something a bit more slim, I've heard good things about some Chromebooks, but that's not something I've done much research on.
 

Nelo Ice

Banned
I think you're more prepared for an entry-level job than you know. You've got a lot of great selling points that make me think you'd perform well in a work environment. You'll learn a lot of new things really quickly in an entry-level job, and that's okay. What recruiters look for in entry-level positions are people that are confident, work well with a team, and are willing to push themselves out of their comfort zone to learn new things. It definitely sounds like you've got the last two; just work out some self-confidence and you'll be good to go.

Thanks for the kind words. I was lagging on updating my resume this past week since I still had the feeling in the back of my head this isn't possible yet. But now I'm def gonna finish it today and if not this weekend at the latest.
 

Kickz

Member
I think you're more prepared for an entry-level job than you know. You've got a lot of great selling points that make me think you'd perform well in a work environment. You'll learn a lot of new things really quickly in an entry-level job, and that's okay. What recruiters look for in entry-level positions are people that are confident, work well with a team, and are willing to push themselves out of their comfort zone to learn new things. It definitely sounds like you've got the last two; just work out some self-confidence and you'll be good to go.



Read the above; the number one thing I wish I had known before going into internships is that it's okay not to know things, and asking questions is okay. You won't know everything, you'll get confused, and you'll feel like you're out of your element. But the reason you were hired is because the recruiter/interviewer thought you could adapt well to a new environment and learn new concepts. No one starts off as a pro- don't try to feel like you should be one within your first week, month, or even year. I seriously overworked myself the first week of my first internship and I was burned out for the rest of the month.

If you're given a mentor/superior to answer to/ask questions in the first couple weeks/months, take full advantage of it and ask them about anything you're confused on.
Unless they end up being kind of a prick, in which case, find a nicer co-worker you can bounce questions off.
Cool, will do. And this looks like a fulltime gig with a team of about 20 devs. I am thinking I should try and set breakpoints and step through my code before asking a question
 
Cool, will do. And this looks like a fulltime gig with a team of about 20 devs. I am thinking I should try and set breakpoints and step through my code before asking a question
Absolutely work to the full extent of your current ability, but you shouldn't ever feel afraid to ask a question if you get stuck or can't figure something out.
 

Kickz

Member
Absolutely work to the full extent of your current ability, but you shouldn't ever feel afraid to ask a question if you get stuck or can't figure something out.

Awesome, I think they said early on tasks might involve fixing the odd bug. Any tips on tackling tasks like this
 
Also, can anyone recommend a slim laptop for programming? My lenovo is a bit too chunky to put in my bookbag and lug around. Plus I wanna read pdf's on the train and program at the same time.

Edit:

Possibly a laptop/tablet hybrid?

I just bought a System 76 laptop right before they updated their whole line (typical) then got a Window's license from my university for free. The design isn't going to turn heads, but it looks way better than the pictures suggest and they were the only manufacturer that offered good hardware without gimmicks at the right price.

I like gtest, but I don't know much about others. If it's good enough for Chrome, it's good enough for me IMO

Hey, it has a mocking framework included so that's a huge plus! Chrome + LLVM + cpp_is_king is enough endorsement for me.
 
Awesome, I think they said early on tasks might involve fixing the odd bug. Any tips on tackling tasks like this

Bug squashing is fairly standard for people just starting out, as it's a good way to introduce you to the workflow of the company/team. You'll likely have to get familiar with a bunch of backend, company-specific tools you've never used before, and there's no amount of programming skill that can help you prepare for all of the various web interfaces/internal tools/hacked together scripts that you'll need to use. The bugs themselves will probably be fairly straightforward (replacing an RPC here, fixing a small edge case there, etc), so don't worry if a problem seems like it only requires changing/adding a few lines of code.
 

BakedYams

Slayer of Combofiends
Before you said 'not a Lenovo', I was going to suggest a ThinkPad... that's the laptop I'm planning on replacing my current one with whenever I get tired of it. I know a lot of systems people that use one and love it. If you're looking for something a bit more slim, I've heard good things about some Chromebooks, but that's not something I've done much research on.

I'm a little on the broke side... I'll keep on searching.

I just bought a System 76 laptop right before they updated their whole line (typical) then got a Window's license from my university for free. The design isn't going to turn heads, but it looks way better than the pictures suggest and they were the only manufacturer that offered good hardware without gimmicks at the right price.

These laptops look really solid but I'm looking for something even cheaper. Its not gonna be a personal laptop, just a coding laptop. My lenovo I have at home is my personal one, spent more than a grand on it, its a monster.
 

Kickz

Member
Bug squashing is fairly standard for people just starting out, as it's a good way to introduce you to the workflow of the company/team. You'll likely have to get familiar with a bunch of backend, company-specific tools you've never used before, and there's no amount of programming skill that can help you prepare for all of the various web interfaces/internal tools/hacked together scripts that you'll need to use. The bugs themselves will probably be fairly straightforward (replacing an RPC here, fixing a small edge case there, etc), so don't worry if a problem seems like it only requires changing/adding a few lines of code.
Cool
 

Koren

Member
K awesome then there is hope. Thanks for your advice. I really do appreciate it. Making feel more confident someone will take me on and I can learn, level up, and get paid for it. Like the Google panelist told me her friend got hired after only being in a bootcamp for 3 weeks.
Google definitively hire people without professionnal experience. I know a couple people that got in, even one with a fluid dynamics phd... But you have to pass tests.
 
I created a small text-based adventure in Java. First time I did something exclusively with text editor and command line interface, it was very instructive. Previously I only did android junk.
I plan to make a new one with more features in the future but for now I just played around with recursions, scanners and switch statements. Besides the inevitable avalanche of typos and one hilarious bug, I'm fairly pleased with what I did in about one and a half hours. I also learned how to package classes into a .jar file and played around with github (which I previously only used to "steal" code from lol).

https://github.com/Zappykeyboard/The-room.git


That said, I'm a bit discouraged. I'm in a similar situation as Kickz, except that in my area there is basically no chance of creating or joining a community of programmers. Except for GAF and one of my friends (which is a physicist that happens to know Python), I'd have nobody to discuss this stuff with. I seriously wonder what to do from here :/
 

Kickz

Member
I created a small text-based adventure in Java. First time I did something exclusively with text editor and command line interface, it was very instructive. Previously I only did android junk.
I plan to make a new one with more features in the future but for now I just played around with recursions, scanners and switch statements. Besides the inevitable avalanche of typos and one hilarious bug, I'm fairly pleased with what I did in about one and a half hours. I also learned how to package classes into a .jar file and played around with github (which I previously only used to "steal" code from lol).

https://github.com/Zappykeyboard/The-room.git


That said, I'm a bit discouraged. I'm in a similar situation as Kickz, except that in my area there is basically no chance of creating or joining a community of programmers. Except for GAF and one of my friends (which is a physicist that happens to know Python), I'd have nobody to discuss this stuff with. I seriously wonder what to do from here :/

Checkout meetup.com, I am apart of the .Net user group in the Twin Cities area
 
Ok, so going off my question from last night, how do you get projects in visual studio to "see" other projects? I'm trying to keep all my unit tests in one assembly, but I can't figure out how to link to my main code base.
 
Ok, so going off my question from last night, how do you get projects in visual studio to "see" other projects? I'm trying to keep all my unit tests in one assembly, but I can't figure out how to link to my main code base.

Build it as a static library and link against it. You can link against it by setting it as a project dependency in project settings.

So say you have an executable, and you want to test it. You need to make this 2 projects, a library which contains the main part of your application, an executable which links against the library (by setting it as a project dependency) and is essentially your program, and a unit test executable which links against both your library (also by setting a dependency) and the gtest library.

Edit: you said assembly, is this .net? I thought this was related to the gtest question from yesterday.
 
Build it as a static library and link against it. You can link against it by setting it as a project dependency in project settings.

So say you have an executable, and you want to test it. You need to make this 2 projects, a library which contains the main part of your application, an executable which links against the library (by setting it as a project dependency) and is essentially your program, and a unit test executable which links against both your library (also by setting a dependency) and the gtest library.

Edit: you said assembly, is this .net? I thought this was related to the gtest question from yesterday.
No, sorry I've just been doing a lot of .NET stuff so I slipped into using that language again.

If you're only doing two projects how do you make a static library and executable out of one project (program) and a third executable? Visual studio's confusing me here.

EDIT: Oh, wait you're saying split up my program into two projects? That sounds like it could easily be a nightmare of a night.
 

BakedYams

Slayer of Combofiends
I created a small text-based adventure in Java. First time I did something exclusively with text editor and command line interface, it was very instructive. Previously I only did android junk.
I plan to make a new one with more features in the future but for now I just played around with recursions, scanners and switch statements. Besides the inevitable avalanche of typos and one hilarious bug, I'm fairly pleased with what I did in about one and a half hours. I also learned how to package classes into a .jar file and played around with github (which I previously only used to "steal" code from lol).

https://github.com/Zappykeyboard/The-room.git


That said, I'm a bit discouraged. I'm in a similar situation as Kickz, except that in my area there is basically no chance of creating or joining a community of programmers. Except for GAF and one of my friends (which is a physicist that happens to know Python), I'd have nobody to discuss this stuff with. I seriously wonder what to do from here :/

Where do you live exactly? You can always try chat rooms for programmers.
 
No, sorry I've just been doing a lot of .NET stuff so I slipped into using that language again.

If you're only doing two projects how do you make a static library and executable out of one project (program) and a third executable? Visual studio's confusing me here.

EDIT: Oh, wait you're saying split up my program into two projects? That sounds like it could easily be a nightmare of a night.

I agree it can be dauting the first time you do it, but honestly it's not that hard. And you're going to have to do this no matter if you're using Visual Studio, Makefiles, CMake, or anything else. The reason is that your program and the unit test runner are two separate executables that need to share the same code -- the code that is being tested.

The way you share code in this way is by creating libraries.

To get up and running the quickest, you can literally change your entire project to a static library. Right click the project node, choose Properties, click General, and set Configuration Type to Static Library (.lib). Change your main function to be called something else like RunProgram(), make a header file and declare RunProgram() in the header file. I'll just call this header file foo.h, but make it something more appropriate.

Now create a new project, this time an Application (.exe). But do it by right clicking the root node in Solution Explorer and choosing Add -> New Project. When VS finishes creating it, you'll now have two projects in the same solution. In your new application project, add a #include "foo.h", then in main() simply call RunProgram().

To make it automatically link the library into the application, right click the project node of the application, choose Build Dependencies -> Project Dependencies, and then click the checkbox for the library. You'll probably need to set the include directories in your exe project to find the folder where the include files for the library are. This is in Project Properties -> C/C++ -> General -> Additional Include Directories.

In a production environment, you would probably create a more realistic separation between your driver / application and your core functionality that you're testing, instead of simply having your main() function be one line that calls the static library. For example, command line parsing, user input, etc would all be handled in the application while processing and utility libraries etc would be handled in the library.

In any case, when you've got all this working, creating the unit test suite is not much different than the application. Make a new Application, add a dependency, go to the Linker and Include settings and add the appropriate paths for gtest, then #include files from your library and start using them in yoru tests.

One common solution for handling the situation with include file paths is for a project to do something like this:

Code:
project
|__ project.sln
|__ src
    |__ application
        |__ main.cpp
        |__ application.vcxproj
    |__ library1
        |__ lib1.cpp
        |__ lib1.vcxproj
    |__ library2
        |__ lib2.cpp
        |__ lib2.vcxproj
|__ include
    |__ application
    |__ library1
        |__ lib1.h
    |__ library2
        |__ lib2.h

Now, in every project, you set your Additional Include folders to $(SolutionDir)include. Then in your application.cpp, you can simply write something like this:

#include "library1/lib1.h"
#include "library2/lib2.h"

And it will automatically find it. This way you dont' have to go manually screw around with the include path settings for every single project. It's always exactly the same value for every project, just "$(SolutionDir)include".

Anyway this is a lot to take in the first time you do it, but it's fairly intuitive once you get used to it.
 

Nelo Ice

Banned
Google definitively hire people without professionnal experience. I know a couple people that got in, even one with a fluid dynamics phd... But you have to pass tests.

Well her friend didn't get hired at Google, she just mentioned she was only at a bootcamp for 3 weeks and a company hired her on anyway. But yeah another panelist said it's not a requirement to have a degree to get hired at Google.
 
Well her friend didn't get hired at Google, she just mentioned she was only at a bootcamp for 3 weeks and a company hired her on anyway. But yeah another panelist said it's not a requirement to have a degree to get hired at Google.

Getting hired at Google is 100% how well you do on the interview. Which itself is about 60% luck.
 
Top Bottom