I am fairly new to C++ and I am trying to decode the piece of code shown below. In particular for the BaseSetAssoc::BlkType* line, I am not sure what the asterisk means in this case. I would appreciate some insight.   BaseSetAssoc::BlkType* NMRU::accessBlock(Addr addr, bool is_secure, Cycles &amp;lat, int master_id) {     // Accesses are based on parent class, no need to do anything special     BlkType *blk = BaseSetAssoc::accessBlock(addr, is_secure, lat, master_id);      if (blk != NULL) {         // move this block to head of the MRU list         sets[blk-&gt;set].moveToHead(blk);         DPRINTF(CacheRepl, "set %x: moving blk %x (%s) to MRU\n",                 blk-&gt;set, regenerateBlkAddr(blk-&gt;tag, blk-&gt;set),                 is_secure ? "s" : "ns");     }      return blk; }
7388
Why are pointers such a leading factor of confusion for many new, and even old, college level students in C or C++?  Are there any tools or thought processes that helped you understand how pointers work at the variable, function, and beyond level?  What are some good practice things that can be done to bring somebody to the level of, "Ah-hah, I got it," without getting them bogged down in the overall concept? Basically, drill like scenarios.
39885
A couple of times I've seen a phrase much like "that's horrible coding &mdash; and I would know from horrible coding!" This seems extremely peculiar to me (if only because of how ungrammatical it is), and while I can guess that it's supposed to be some emphatic way to indicate the subject's authority on the matter, it's pretty unusual and I don't fully grasp it.  Unfortunately, I don't have a good verbatim example on hand, so it's possible my memory is muddling the context of the phrase slightly.  Anyway, what does this bizarre turn of phrase mean exactly and where does it come from?
1377
Is there any good reason that an empty set of round brackets (parentheses) isn't valid for calling the default constructor in C++?  MyObject  object;  // ok - default ctor MyObject  object(blah); // ok  MyObject  object();  // error   I seem to type "()" automatically everytime. Is there a good reason this isn't allowed?
62585
Given the following example, why do I have to explicitly use the statement b-&gt;A::DoSomething() rather than just b-&gt;DoSomething()?  Shouldn't the compiler's overload resolution figure out which method I'm talking about?  I'm using Microsoft VS 2005. (Note: using virtual doesn't help in this case.)  class A {   public:     int DoSomething() {return 0;}; };  class B : public A {   public:     int DoSomething(int x) {return 1;}; };  int main() {   B* b = new B();   b-&gt;A::DoSomething();    //Why this?   //b-&gt;DoSomething();    //Why not this? (Gives compiler error.)   delete b;   return 0; }
53471
Now that it's clear , there is an associated concept that I use all the time without knowing what it really means.   I suppose everybody made once a mistake with parenthesis, resulting  in an "object is not callable" exception. What's more, using __init__ and __new__ lead to wonder what this bloody __call__ can be used for.  Could you give me some explanations, including examples with the magic method ?
83085
This is a weird phenomenon.  Consider the following code:  \documentclass{article} \begin{document}   $$Z^* \frac{Z^*}{Z^*}$$ \end{document}   It produces the following picture:    The asterisks appear in various places in comparison to the Z. This looks particularly bad in the denominator. Any idea what's behind this?
108390
I've never been a fan of Hungarian notation, I've always found it pretty useless unless you're doing some really low level programming, but in every C++ project I've worked on some kind of Hungarian notation policy was enforced, and with it the use of some 'not-really-Hungarian' prefixes as m_ for fields, s_ for statics, g_ for globals and so on.  Soon I realized how much useless it was in C# and gradually started to drop all of my old habits... but the 'm_' thing. I still use the m_ prefix on private fields because I really find it very useful to being able to distinguish between parameters, locals and fields.  The  says I shouldn't, but it does not say why (the way e.g. Google's conventions generally tend to rationalize their prescriptions).  Are there reasons why I shouldn't or is it only a matter of style. If it is the latter, are prefixes generally considered a bad style and can I expect negative reactions from other people working on the codebase?
5240
As mentioned in many of my previous questions, I'm working through K&amp;R, and am currently into the preprocessor. One of the more interesting things &mdash; something I never knew before from any of my prior attempts to learn C &mdash; is the ## preprocessor operator. According to K&amp;R:     The preprocessor operator ##   provides a way to concatenate actual   arguments during macro expansion. If a   parameter in the replacement text is   adjacent to a ##, the parameter is   replaced by the actual argument, the   ## and surrounding white space are   removed, and the result is re-scanned.   For example, the macro paste   concatenates its two arguments:      #define  paste(front, back)  front ## back      so paste(name, 1) creates the token   name1.   How and why would someone use this in the real world? What are practical examples of its use, and are there gotchas to consider?
17001
I'm wondering where I find the source to show how the operator ** is implemented in Python.  Can someone point me in the right direction?
109023
When I was looking at someone's Verilog code, I found "+:" in Verilog. It looks like an arithmetic function but I'm not sure. I never seen before. Does anyone know this usage?  Update:  csum= csum + one_cnt[i* ('DPC_shift +1) +: ('DPC_shift +1)];   I have a query, is this synthesiable?
107323
So I recently discovered the --s2k mode in gpg.  Sadly it is not very well-documented. I mean, what is s2k even supposed to mean?  Could someone explain to me the purpose and detailed function of s2k?    Is --s2k-cipher-algo even necessary in a symmetric encryption scenario where you define the cipher separately?  What exactly  does --s2k-count do?  What does the number after --s2k-count do? What does it indicate and why is 65 million the highest number? 65 million of what? What is done so many times?
108044
I don't think I fundamentally understand what an enum is, and when to use it.    For example:  typedef enum {     kCircle,     kRectangle,     kOblateSpheroid } ShapeType;   What is really being declared here?
16217
I've just read this  from Reddit.  They mention and and or being "Alternative Tokens" to &amp;&amp; and ||  I was really unaware of these until now. Of course, everybody knows about the , but and and or? Since when? Is this a recent addition to the standard?  I've just checked it with Visual C++ 2008 and it doesn't seem to recognize these as anything other than a syntax error. What's going on?
113560
I expected A::~A() to be called in this program, but it isn't:  #include &lt;iostream&gt;  struct A {   ~A() { std::cout &lt;&lt; "~A()" &lt;&lt; std::endl; } };  void f() {   A a;   throw "spam"; }  int main() { f(); }   However, if I change last line to   int main() try { f(); } catch (...) { throw; }   then A::~A() is called.  I am compiling with "Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86" from Visual Studio 2005. Command line is cl /EHa my.cpp.  Is compiler right as usual? What does standard say on this matter?
77292
I have come across this symbol a few times, and I am not sure what it "does" or what it means: $\Large\sum$
98178
key__c :- abcdefghijklmnop  public static String decrypt(String data) {     EncryptionSettings__c settings = EncryptionSettings__c.getOrgDefaults();     if (settings.key__c == null) {         throw new FacebookException('Cannot decrypt without a key!');     }     Blob key = EncodingUtil.base64Decode(settings.key__c);     return Crypto.decryptWithManagedIV('AES128', key, EncodingUtil.base64Decode(data)).toString(); }  public static String encrypt(String data) {         EncryptionSettings__c settings = EncryptionSettings__c.getOrgDefaults();     Blob key = null;     if (settings.key__c == null) {         checkUserCanCustomizeApplication();         key = Crypto.generateAesKey(128);         settings.key__c = EncodingUtil.base64Encode(key);         insert settings;     } else {         key = EncodingUtil.base64Decode(settings.key__c);     }     return EncodingUtil.base64Encode(Crypto.encryptWithManagedIV('AES128', key, Blob.valueOf(data))); }
64613
I was wondering if anyone around here could give me some explanation on this type of attacks. Pretty much the only thing that I could find is .  What I really need is basic explanation of the attack itself with a small example if possible such as any basic block cipher that you could come up with with 3-4 rounds. This is for my personal understanding so any input is more than welcome.