Myclass::field2 ^ this->staticField1 #rare

(Java is cleaner.)

MyClass::field2 can refer to a non-static field or static field. Useful when MyClass is a superclass.

I believe this->field1 can refer to a static field too!

I believe this->method2 can refer to a static method!

Advertisements

switching between LESS, vi, TAIL …

less -> vi : “v”

tail -> less? Nothing found.

–from within vi,
switch to readonly mode: qq( :se ro )
switch to readwrite mode: qq( :se noro )

—less to replace tail -f
$ less /var/log/messages

Common-mode -> Follow-mode: F
Follow-mode -> Common-mode: Ctrl-c

To start less in the Follow-mode,
$ less +F /var/log/messages

Within finance, technology outlives most job functions

Look at these job functions —

* Many analysts in finance need to learn data analytics software ….
* Risk managers depend on large risk systems…
* Quants need non-trivial coding skill…
* Everyone in finance needs Excel, databases, and … financial data.
…. while the IT department faces no threat, except outsourcing. Why?

Surely … Financial data volume is growing
Surely … Automation reduces human error, enforces control — operational risk…
Computer capabilities are improving
Financial data quality is improving
Computers are good at data processing, esp. repetitive, multi-step…
Financial info tech is important and valuable (no need to explain), not simple, requires talent, training, experience and a big team. Not really blue-collar.

Many techies point out the organizational inefficiencies and suggest there’s no need for so many techies, but comparatively is there a need for so many analysts, or so many risk managers, or so many accountants or so many traders? Every role is dispensable! Global population is growing and getting better educated, so educated workforce must work.

non-virtual dtor: some random scenarios tested #IV

Background — How important are these scenarios? First off, tech quizzes are extremely important since you are judged just over a few questions. Second, these scenarios pop up by accidents, rather than be design, all the time in real projects. You better learn to deal with a drunken driver while on the road.

Q1: what if Base and Derived dtor both non-virtual and an autoVar is destroyed?
AA: Tested — ~Derived() and then ~Base().  See post on DCBC.

Q2: What if Base dtor is non-virtual but Derived is virtual, and a Derived auto variable is destroyed on the stack?
AA: Same as Q1. For an autoVariable that’s not deleted via a ptr, Derived ctor (virtual or not) runs, followed by Base dtor. Same DCBC

Q3: Base dtor is non-virtual but Derived is virtual. Derived heap pointer is assigned to a B pointer and deleted?
AA: only ~Base runs , in my g++ test, though officially UB.

Q4: Base and Derived are virtual. Derived heap pointer is assigned to a B pointer and deleted?
AA: ~Derived() then ~Base(). DCBC + dynamic dispatch

Note the well-known __undefinedBehavior__ affects delete only, not stack variables or static variables.Note virtual keyword affects pointer variable. Non-ref variables aren’t affected.

The object to destruct is a Derived
~B ~D st? delete heap D via B* or D* test result notes
1 nv nv stack ~D~B DCBC + static dispatch
2 nv virtual stack ~D~B DCBC + static dispatch
3 nv virtual B*  ~B only static dispatch. “virtual” ignored
4 v virtual D*  ~D~B DCBC + dynamic dispatch
5 v implicitly v D*  ditto ditto
struct B{
  ~B(){ cout<<"~B\n";}
};
struct D: public B{
  virtual ~D(){ cout<<"~D\n";}
};
int main(){
  B* myD=new D();
  delete myD;
}