I had blogged about this before, such as the blogger-pripri post on “many long term career options”
Hongzhi asked what if you can’t go to the US.
* Some Singapore companies simply keep their older staff since they still can do the job, and the cost of layoff is too high.
* Support and maintenance tech roles
* Some kind of managerial role ? I guess I am mediocre but could possibly do it, but i feel hands-on work is easier and safer.
* Teach in a Poly or private school ? possibly not my strength
* Run some small business such as Kindergarten with wife
It’s kinda hard to measure 2 developers’ output. Given my background within my past teams, I now feel I did reasonably well on GTD, not super productive or super slow.
- In OC, I took care of Guardian, Quest, Excel interface, Bloomberg and other part of GMDS. I helped out on GMDS testing a few times. I wrote the web-based log viewer in WCF…. I think my productivity was reasonable. The donut bonus was at least 50% due to manager relationship.
- In contrast, at 95Green and Barcap my GTD was not much higher, but the value of my output was higher than team peers.
- In Stirt and Macquarie, manager felt I was good enough to be transferred to other teams.
- Stirt — I had lower value-add than the veterans, but probably higher value-add than most new joiners. Technically I was rated competent by everyone, otherwise they wouldn’t set up the transfer.
- Macquarie role has very high requirements in terms of communication, leadership, but in terms of technical expertise I was clearly appreciated, otherwise they wouldn’t hint the internal transfer.
See also std::string/vector are on heap; reserve() to avoid re-allocation
std::vector — payload is an array on heap. Housekeeping fields hold things like size, capacity, pointer to the array. These fields are allocated either on stack or heap or global area depending on your variable declaration.
- Most STL (and boost) containers are similar to vector in terms of memory allocation
- std::string — payload is a char-array on heap, so it can expand both ways. Housekeeping data includes size…
- shared_ptr — payload includes a ref counter and a raw-pointer object  on heap. This is the control-block shared by all “club members”. There’s still some housekeeping data (pointer to the control block), typically allocated on stack if you declare the shared_ptr object on stack and then use RAII.
If you use “new vector” or “new std::string”, then the housekeeping data will also live on stack, but I find this practice less common.
 this is a 32-bite pointer object, not an pure address. See 3 meanings of POINTER + tip on q(delete this)
I think it’s the author of [[safe c++]] who pointed out that if we have to maintain non-default big4, then it’s extra workload for the maintenance programmer. He argued convincingly that it’s not a good idea to require other programmers or yourself to “always remember to do something”
pointer as field –#1 pattern in c++ explains that shared_ptr as a pointer field allows us to use the default big4.
array field is less common in java/c# than in c++ and include vector, hashtable, deque.
As an alternative, please consider replacing the array with a vector. This would use heap memory but total memory usage is probably similar.
- benefit — lower risk of seg fault due to index out of range
- benefit — growable, though in many cases this is unneeded
- benefit — different instances can different sizes, and the size is accessible at run time.
- benefit — compared to a heap array as a field, vector offers RAII safety
If you define operator<<() for a basic ValueObject class like Cell, to be used in higher-level class like Board, then you need to make this declaration visible to Board.cpp via header files.
If you only put the definition of operator<<() in a ValueObj.cpp and not the ValueObj.h, and you link the object files ValueObj.o and Board.o, everything compiles fine. When Board.cpp calls operator<< on this Cell object it would use the default operator<< rather than yours.
Choice 1: ptr param. You have the flexibility to pass in NULL, but you have the extra burden to check nulls, or risk seg fault.
Google style guide prefers this.
Choice 2: use a non-const reference param.
(many interviewers asked…)
Most common situation — static lib pre-compiled on toolchain A, then linked with code compiled on toolchain B. Usually we just try our luck. If not working, then we compile all source files on the same toolchain.
Toolchain A and B could differ by version, or compiler brand, or c vs c++ … I guess there’s an Application Binary Interface between different toolchains
It’s often easier, more lucrative to focus on the affluent consumers, but consider “value”.
Example — trading techniques. This kinda teaching doesn’t really have much social value, except .. risk reduction? Zero-sum game … you help some win, so other investors must lose.
Example — coach some brainy kids get into gifted classes. This is gaming the competitive “system”. Actually the poor kids need your help more.
Example — coach table tennis kids win competitions. Arguably you help improve the table tennis game, but how much social value is there? Mostly you are helping those few individual kids
Many other teaching subjects do have social value
- languages, writing
- tech, math, science
- health care
- financial literacy
The ERE author enjoys learning practical skills as a hobby. In fact, his learning programs could be more than a hobby, since he has no full time job.
However, I am very different human being from him. I feel very few such learning programs can the mainstay during my semi- or full retirement. Why?
- I need to work towards some level of commitment, and a daily routine.
- I need to make some contribution and be paid for it
- I prefer interaction with other people
I hit many errors with memcpy, but memset can show the same error more easily:
static size_t aa = 0;
static unsigned char buf;
memset(buf, 1, 16);
cout<<aa<<endl; //prints 72340172838076673