Thread: How much is good pay for C++

  1. #16
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Quote Originally Posted by brewbuck View Post
    but it helps if you are a bad-ass programmer.
    Or know the intricacies of some rare protocol, device or sytems and have the right cards (inductions, security, 4WD, etc) to get on site.

    My next contract is 8 days for a SAT (site acceptance test) in the middle of the outback for a rail asset protection system . I will make 1/3 of what I made in a whole year as a graduate.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  2. #17
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by abachler View Post
    I outsourced a more or less straight forward class to rentacoder once, because i didnt have time to mess with it but I needed it done around the same time i finished the core of the application. Ended up having to reexplain the requirements like 3 times even though I spelled out in no uncertain terms things like -

    1. Cannot use MFC or STL or ATL. They guy gave me an MFC class that used STL.
    2. Must compile on Visual Studio 6.0 ( was using a lot of inline SSE assembly) He gave me a 2003 SLN.
    3. Must be suitable for multiple instances of the class. He wrote it as a DLL that used global variables and would choke if you tried to create two instances of the class.
    ...
    I can see why you wouldn't want to use a bloated pig like MFC, but what's wrong with STL?

    Did you actually pay for the crap you got, or can you basically fire the coder & get your money back?
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #18
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by cpjust View Post
    I can see why you wouldn't want to use a bloated pig like MFC, but what's wrong with STL?
    Personal preference. A lot of the programming I do is very low level, high performance, or real time applications. I guess ive just never seen the point of STL when its so much better and easier (at least for me) to implement the functionality explicitly. Case in point, vector, ok im sorry but this is just an array.
    Code:
    vector<int> v(3);
    
    int v[3];
    There is no difference. Except that the STL method is a little more wordy.

    The methods you can use are nice, but honestly, how difficult is it to implement the reverse function, unless i guess you've never done it before. And what happens when you want the reverse function to do some special method of sorting while its reversing, well, then the STL just chokes and you end up using it just like an array.


    Don't get me wrong, I'm not saying that templates arent useful to some programmers. I don't like it, I don't want it in my code. It was a fairly straight forward requirement. Given the fact that there is absolutely no need for the STL in the code I requested it really wasn't unreasonable. The fact that he didn't even USE any of the methods made it clear that he either didn't read the requirements or just ignored them.

    Did you actually pay for the crap you got, or can you basically fire the coder & get your money back?
    Yeah it ended up working although it was pretty crappy performance and sloppy coding. The project requirements needed to be met, as long as we had a working prototype by the deadline we were fine, I could always fix the code in the next phase. I may not be the greatest programmer that ever lived, or have the fancy CS degree that a lot of other software engineers have (my degree is in electronics engineering), but I always get the job done no matter what it takes and I have been working with computers for nearly 30 years. I started teaching myself assembly when I was 10 years old. I have always had a knack for computers.
    Last edited by abachler; 07-26-2009 at 03:26 AM.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by abachler
    Case in point, vector, ok im sorry but this is just an array.
    (...)
    There is no difference. Except that the STL method is a little more wordy.
    Actually, there is a difference in that a std::vector can be resized, but an array cannot. The actual equivalent (still as wordy) is:
    Code:
    std::tr1::array<int, 3> v;
    The difference would be that this array object "knows" its own size, and is not converted to a pointer to a pointer to its first element unless explicitly requested.

    Quote Originally Posted by abachler
    The methods you can use are nice, but honestly, how difficult is it to implement the reverse function, unless i guess you've never done it before.
    Agreed, but then these algorithms are convenient and there is less chance of a silly bug in well tested code that has already been written (and thus code that you do not need to write).

    Quote Originally Posted by abachler
    And what happens when you want the reverse function to do some special method of sorting while its reversing, well, then the STL just chokes and you end up using it just like an array.
    hmm... wouldn't that be sorting instead, and hence std::sort could be used with say, a custom predicate?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by abachler View Post
    The methods you can use are nice, but honestly, how difficult is it to implement the reverse function, unless i guess you've never done it before.
    Using that logic, why bother using any of the standard functions when you can just implement the entire C library yourself?
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  6. #21
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by cpjust View Post
    Using that logic, why bother using any of the standard functions when you can just implement the entire C library yourself?
    I do see your point. If the end result is ending with our own library as opposed to using the standard library... where is the gain?

    But careful
    Some standard functions deserve just that. atoi and atol comes immediately to mind. Really ugly logic in these two.

    Code:
    int atoi(const char *str);
    Really is bad design. Exactly the type of thing we are told not to do. I'd rather have something like the following so that proper error handling could be implemented.

    Code:
    int atoi(int *result, const char *str);
    The function return value could then be used to diagnose the success of the conversion, while int *result would point to the actual conversion value.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #22
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    strtol was here, atoi is a loser

  8. #23
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I wouldn't go that far.

    The problem with strtol is that errno is not set if the function succeeds. So you again cannot rely on it for proper error handling on the case of 0.

    Use case:
    1. Input: "hello" -> strtol fails. errno is set to EINVAL. Function returns 0
    2. Input: "0" -> strtol succeeds. errno remains at EINVAL. Function returns 0.
    Last edited by Mario F.; 07-26-2009 at 12:10 PM. Reason: removed a reference to undefined behavior. strtol always return 0 if it fails. Contrary to atoi/atol
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #24
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Mario F. View Post
    I wouldn't go that far.

    The problem with strtol is that errno is not set if the function succeeds. So you again cannot rely on it for proper error handling on the case of 0.

    Use case:
    1. Input: "hello" -> strtol fails. errno is set to EINVAL. Function returns 0
    2. Input: "0" -> strtol succeeds. errno remains at EINVAL. Function returns 0.
    You are allowed, and encouraged, to clear errno before calling a function if the only way to determine failure is by examining errno. Not exactly elegant, but it does work.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #25
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by brewbuck View Post
    You are allowed, and encouraged, to clear errno before calling a function if the only way to determine failure is by examining errno. Not exactly elegant, but it does work.
    Yes but the real stupid part about strtol() is that it only sets errno for certain kinds of errors:
    If the string is empty, contains only whitespace, or does not contain an initial substring that has the expected syntax for an integer in the specified base, no conversion is performed. In this case, strtol returns a value of zero and the value stored in *tailptr is the value of string.
    Notice it does not say it will throw an error for this, and in fact it does not. What it throws an error for is this:
    If the string has valid syntax for an integer but the value is not representable because of overflow, strtol returns either LONG_MAX or LONG_MIN (see Range of Type), as appropriate for the sign of the value. It also sets errno to ERANGE to indicate there was overflow.
    So in other words, feed it a bad string and errno is not changed, feed it too large a number and that is an errno error. strtol() never sets EINVAL -- you are supposed to detect invalid input using the return value and *tailptr.

    strtol() is better than atoi() but still an unnecessary hassle with the error checking.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #26
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Yes but the real stupid part about strtol() is that it only sets errno for certain kinds of errors
    As it should. You are suggesting there be a errno definition for bad strings (moreso than there already is) but that would require specification for what a bad string is in the standard. They could have easily gone with the simplistic "If conversion doesn't stop at '\0' then EBADSTRING is stored in errno..." You'd still have to do a fair bit of cooking your input to work with this particular verse. With that being the case, I imagine if it was debated at all, that the standards committee decided that the right thing was to let the programmer specify and check accordingly, through endptr.
    Last edited by whiteflags; 07-27-2009 at 02:08 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ok know it will exacut till pay input
    By fmchrist in forum C Programming
    Replies: 2
    Last Post: 01-02-2006, 07:33 AM
  2. I'm so not good at this and need help
    By notacgirl in forum C Programming
    Replies: 33
    Last Post: 10-31-2005, 03:33 PM
  3. Good resources for maths and electronics
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 12-22-2004, 04:23 PM
  4. what is good for gaphics in dos
    By datainjector in forum Game Programming
    Replies: 2
    Last Post: 07-15-2002, 03:48 PM
  5. i need links to good windows tuts...
    By Jackmar in forum Windows Programming
    Replies: 3
    Last Post: 05-18-2002, 11:16 PM