Summary of programming errors

  1. In codeBlocks, the sizeof() function has incorrect statistics. You need to use #pragma pack(push, 1) and #pragma pack(pop) to get the statistics correct, __attribute__((packed)); is incorrect
#if _MSC_VER
#pragma pack(push, 1)
#endif
template<typename T1, typename T2>
struct Pair{

	T1 first;

	T2 second;

	/// \brief constructor, default
	Pair(): first(0), second(0) {}

	/// \brief constructor, copy
	Pair(const Pair& _item): first(_item.first), second(_item.second) {}

	/// \brief constructor, component
	Pair(const T1& _first, const T2& _second) : first(_first), second(_second) {}

	/// \brief min value
	static Pair& min_value() {

		static Pair min_val = Pair();

		return min_val;
	}

	/// \brief max vlaue
	static Pair& max_value() {

		static Pair max_val = Pair(std::numeric_limits<T1>::max(), std::numeric_limits<T2>::max());

		return max_val;
	}

	/// \brief output
	friend std::ostream& operator << (std::ostream _os, const Pair& _item) {

		return _os << "first: " << _item.first << " second: " << _item.second << std::endl;

	}
}
#if _MSC_VER
;
#pragma pack(pop)
#else
__attribute__((packed));
#endif
  •  The program has an inexplicable error. When cur_bkt = 168, the LMS character predecessor will be less than or equal to the current character. It is not just a logic error or a program bug. It is planned to use this class in the process of pq derivation to test whether the program is running normally. (The reason is that there is an error in reading and writing files in the Windows system, and the Linux system is correct)
  • Replacing with a deque is still an error.
  • SAIS( string & _s, offset_vector_type *& _sa_reverse); This line always reports an error, the reason is: string is an unknowable type, add  std::string in front , the program is correct
  • When using MyVector, there are next, next_remove, next_reverse, next_remove_reverse in the sequential reading and writing process and the reverse order reading and writing process. If the order is wrong, it will cause inexplicable errors. 20180319 and 20180320 Two days to find the error of deriving SStar
  • When using your own macro: #define __FILE_INFO__ std::cout << "Error occurrences. File name:" << __FILE__ << " , Line number:" << __LINE__ << " , Function name: " << __FUNCTION__ << ".\n"; std::cin.get(); , the program stays in the console, nothing happens, it works fine after deletion

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326250418&siteId=291194637