Archives: software programming

Go Language vs C/C++ 1/5 (1)

I have spent several days on Go. It is a little more similar to C, not C++. As it has no class concept, only structure.  Also it has pointer ( but no pointer arithmetic), interface. Also it has slice, map, go routine( for multi-thread) which make it unique. Overall it is could be a good language. Here • Read More »


What’s the difference between BNF, EBNF, ABNF, ASN.1 ? 1/5 (1)

Abstract Syntax Notation One (ASN.1) is mainly for binary protocol, it is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data intelecommunications and computer networking.. A good tools like asn1c can convert ASN.1 to C structure, encoder/decoder. BNF, EBNF, ABNF are for text format parsing. In terms of power, • Read More »




Bison/Yacc cheat sheet ( Parser Generator cheat sheet) 0/5 (1)

The same thing happened to bison/yacc, I googled around, and was a little surprised that I could not find a bison/yacc cheat sheet. So I made a very rudimentary one here. Bison-Yacc_cheat_sheet Please comment on how to improve it. References: https://www.gnu.org/software/bison/manual/html_node/index.html Please rate this rating



GDB cheatsheat No ratings yet.

GDB cheatsheat There is a good gdb cheatsheet at http://darkdust.net/files/GDB%20Cheat%20Sheet.pdf The output format for print, x is missing  there, somehow I think it is useful to add the output formats: x,d,u,o,t,a,f,s,z,r please see https://sourceware.org/gdb/onlinedocs/gdb/Output-Formats.html  How do we usually run gdb commands normally we compile the source code with  CPPFLAG -g ( please no -O, otherwise some code are • Read More »


std::unique_lock vs std::lock_guard No ratings yet.

The std::unique_lock class is a lot more flexible when dealing with mutex locks. It has the same interface as std::lock_guard but provides additional methods for explicitly locking and unlocking mutexes and deferring locking on construction As a general rule, std::lock_guard should be preferably used when the additional features of std::unique_lock are not needed use cases: • Read More »


How C++11 lambda is implemented No ratings yet.

Quota from a good article from http://www.cprogramming.com/c++11/c++11-lambda-closures.html It turns out that the way lambdas are implemented is by creating a small class; this class overloads the operator(), so that it acts just like a function. A lambda function is an instance of this class; when the class is constructed, any variables in the surrounding enviroment • Read More »


Python @staticmethod, @classmethod No ratings yet.

Found a good one to explain: How @staticmethod and @classmethod are different. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 class Kls(object):     no_inst = 0   #( this would be class level variable)     def __init__(self, data):         self.data = data  #  (this would be instance variable)      def printd(self):         print(self.data) • Read More »