下記のコードは汎用変数*tattrに値を設定していると思いますが、
Aの設定方法とBの設定方法は機能的に同じと思いますが
敢えて、Aのコードを使用する意味(価値)はありますか?
..#include <pthread.h>
pthread_attr_t *tattr; //blobal
int main(){
/*
do{ //<---A
if( (tattr=(pthread_attr_t *)malloc(sizeof(pthread_attr_t)) )==NULL){
printf("Couldn't allocate memory for attribute object\n");
}
} while(tattr==NULL);
*/
tattr=(pthread_attr_t *)malloc(sizeof(pthread_attr_t)); //<---B
.....
}
以上宜しくお願いします。
回答2件
あなたの回答
tips
プレビュー