---

Date: 2007-05-08 20:48
Subject: видео
Security: Public
Tags:cpp, features

New Features in the Next C++ Standard

Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2007-03-01 12:49
Subject: (no subject)
Security: Public
Tags:cpp, volatile

Вопрос тут возник по С++.

Что у меня дано:

struct s
{
  bool b;
};

void foo (s * p)
{
  if (p->b)
  {
    bar();    // <-- косвенно, очень косвенно меняет p->b

    if (p->b)
    {
      buzz();
    }
  }
}


Необходимо ли указать volatile у s::b?

9 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2007-02-17 23:15
Subject: (no subject)
Security: Public
Tags:cpp

Сегодня нашел у себя забавный косяк, который решился с помощью explicit конструктора. Будет мне новое слово в с++ копилку и опыт не забывать explicit вот в таких вот ситуациях :

struct Parent
{
};

struct Child : public Parent
{
  explicit Child(const Parent & c);
};

4 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2007-01-08 01:12
Subject: (no subject)
Security: Public
Tags:cpp, cpp-standard, pod-types, tech

Не давно зашел разговор про то, что же считать POD типом. Я даже как то не смог, четко сказать, чего там быть не должно, единственное, о чем вспомнил - отсутствие виртуальных функций.

Вчера полез в стандарт и все что нашел:

9/4
A POD-struct is an aggregate class that has no non-static data members of type non-POD-struct, non-POD-union (or array of such types) or reference, and has no user-defined copy assignment operator and no user-defined destructor. Similarly, a POD-union is an aggregate union that has no non-static data members of type non-POD-struct, non-POD-union (or array of such types) or reference, and has no userdefined copy assignment operator and no user-defined destructor. A POD class is a class that is either a POD-struct or a POD-union.


Вот тут я нашел следующее:
As an example, the C declaration struct Fred x; does not initialize the members of the Fred variable x. To make this same behavior happen in C++, Fred would need to not have any constructors. Similarly to make the C++ version of copying the same as the C version, the C++ Fred must not have overloaded the assignment operator. To make sure the other rules match, the C++ version must not have virtual functions, base classes, non-static members that are private or protected, or a destructor. It can, however, have static data members, static member functions, and non-static non-virtual member functions.


Так все таки можно ли в POD-типе иметь конструктор или нет?

6 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2006-06-14 10:33
Subject: (no subject)
Security: Public
Tags:cpp, cpp-standard, links

Кстати, да. Тут лежит версия стандарта от 2003 года. И из нее можно копировать ;))

5 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2006-03-23 23:52
Subject: (no subject)
Security: Public
Music:Мельница - Ночная кобыла
Tags:cpp, links

Чтобы не потерять линк: http://mxax.livejournal.com/24573.html?mode=reply

Post A Comment | Add to Memories | Tell a Friend | Link



---
Date: 2006-03-06 18:13
Subject: (no subject)
Security: Public
Tags:cpp

Вот нашел сегодня такой косяк в билдере или это может я что-то не то делаю ;)
Под седьмой студией нормально компилируется.

Код:

enum e_enum
{
    e1, e2, e3
};

template <class T>
struct table
{
    std::vector<T>      tbl;
};

struct table2
{
};

template <e_enum X>
struct entity
{
    static table<entity<X> > * tbl_;
    //static table2          * tbl_;
};

template <e_enum X>
table<entity<X> > * entity<X>::tbl_ = 0;    // косяк тут !

//template <e_enum eee>
//table2 * entity<eee>::tbl_ = 0;


/*
[C++ Error] Unit1.cpp(32): E2356 Type mismatch in redeclaration of 'entity<X>::tbl_'
[C++ Error] Unit1.cpp(27): E2344 Earlier declaration of 'entity<X>::tbl_'
*/


Как бы это исправить еще?

2 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2005-11-09 19:45
Subject: cpp :: sizeof(enum)
Security: Public
Music:Origa - The Best Of 1999 - 02 - Lilika
Tags:cpp

enum e_type
{
    pt_data
    , pt_data_accept
    , pt_error
};

sizeof(enum) Implementation defined. Легальным ли будет хак (см. ниже) для того, чтобы в C++ Builder 6 и студии 2003 sizeof был одинаковый?

enum e_type
{
    pt_data
    , pt_data_accept
    , pt_error
    , pt_hack = INT_MAX
};


Да, да - сам не хочу юзать BCB, но пока деваться некуда :(

3 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2005-11-08 14:00
Subject: что я буду читать
Security: Public
Music:Origa - The Best Of 1999 - 04 - We Can Hear Your Pulse
Tags:cpp

Хехе, сделал себе маленький подарочек: купил книги Саттера "Решение сложных задач на С++" и "Новые сложные задачи на С++".

11 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2005-11-04 13:41
Subject: тест на брайнбенче
Security: Public
Music:Kai Tracid - 4 Just 1 Day (Club Mix)
Tags:brainbench, cpp, tests

Прошел тесты по с++ и OO Concepts на брайнбенче.
Сделаю не большое сравнение :)

13.07.2004/04.11.2005

с++: 3.44/4.21
ooc: 2.57/2.59

2 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2005-10-25 19:18
Subject: (no subject)
Security: Public
Tags:cpp

int foo(int & bar)
{
    return bar = 1;
}

int main()
{
    int bar = 1;
    bar = foo(bar);
}


Что здесь преступного?


20 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2005-10-04 20:02
Subject: (no subject)
Security: Public
Music:Bubblegum Crisis - Bluew - Mr. Dandy
Tags:cpp

По сравнению со студией с++ билдер имеет убогую систему watch'ей. Debug Inspector это вообще отдельный ужас.
И редактор там ужасный, скажу по секрету - код для билдера пишу в студии ;)

3 Comments | Post A Comment | Add to Memories | Tell a Friend | Link



Date: 2005-09-20 19:16
Subject: (no subject)
Security: Public
Tags:cpp

...
код:
printf( "%d %d", f( i++ ), f( i++ ) );

И никто того программера не собирается за ворота, а очень даже
уважаемый программист в конторе. И другие еще удивлялись, а че это глючит? И
знаете какое решение нашли? Эту пременную объявили volatile. Добро пожаловать в
реальный мир...

тут

Я поражаюсь этим людям :((

1 Comment | Post A Comment | Add to Memories | Tell a Friend | Link



my journal
June 2008
links 2