Post

Replies

Boosts

Views

Activity

Important bug for C++ object dynamic delete in XCode Compiler
I have a sample code to test c++ virtual deconstructor like below: #include <iostream> class CA { public:   virtual ~CA() {     std::cout<< "~CA" << std::endl;   } }; class CB :public CA {    public:   virtual ~CB() {     std::cout<< "~CB" << std::endl;   } }; int main(int argc, const char * argv[]) {       CA *pb = new CB[3];   delete []pb;       return 0; } in xcode this code print out result is : ~CA ~CA ~CA but in other compilers like visual studio C++ and gcc the print out result is: ~CB ~CA ~CB ~CA ~CB ~CA I think this is a dynamic delete array object with virtual deconstructor bug in xcode compiler 。 because the print result is not conform to C++ form。
1
0
849
Aug ’22
set UILabel's backgroundColor to nil is incorrect
I create a UILabel object in viewDidLoad of UIViewController like below: language(void) viewDidLoad {     [super viewDidLoad]; UILabel *tt = [UILabel new];        tt.text = @"abcd";        tt.frame = CGRectMake(100, 100, 100, 50);     tt.backgroundColor = nil;        [self.view addSubview:tt]; } I set the tt.backgroundColor is nil。 but when UILabel appeared, the backgroundColor is black ! and I adjust tt.text=@"abcd中"。 the backgroundColor is working and the color is clear。 PS: Xcode version :11.3 (11C29) iPhone11 simulator。
1
0
1.3k
Mar ’21