只是一些笔记

歪酷博客
Px @ 2006-05-24 11:28



 
Px @ 2006-05-24 11:06

// wx_pch.h
#ifndef WX_PCH_H
#define WX_PCH_H
 
#if ( defined(USE_PCH) && !defined(WX_PRECOMP) )
    #define WX_PRECOMP
#endif // USE_PCH
 
// basic wxWidgets headers
#include <wx/wxprec.h>
 
#ifdef __BORLANDC__
    #pragma hdrstop
#endif
 
#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif
 
#ifdef USE_PCH
    // put here all your rarely-changing header files
#endif // USE_PCH
 
#endif // WX_PCH_H


/******************************************************************/

// main.cpp

#include <wx/wxprec.h>
 
#ifdef __BORLANDC__
    #pragma hdrstop
#endif
 
#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif
 
#include "wx/xrc/xmlres.h"
#include "mainframe.h"

 
class MyApp : public wxApp
{
    public:
        virtual bool OnInit();
};
IMPLEMENT_APP(MyApp);
 
bool MyApp::OnInit()
{
    yuv2rgb_c_init();
    wxImage::AddHandler(new wxGIFHandler);
    wxImage::AddHandler(new wxJPEGHandler);
    wxXmlResource::Get()->InitAllHandlers();
    wxXmlResource::Get()->Load(L"rc/frame.xrc");
    wxXmlResource::Get()->Load(L"rc/menu.xrc");
    mainFrame* frame = new mainFrame();
    frame->Show();
    return true;
}
 
/******************************************************************/

// mainframe.h
#ifndef MAINFRAME_H
#define MAINFRAME_H

 
class MainFrame : public wxFrame
{
    public:
        MainFrame(wxWindow* parent=(wxWindow *)NULL);
        virtual ~MainFrame();
    protected:
    private:
        DECLARE_EVENT_TABLE();
};
 
#endif // MAINFRAME_H

/******************************************************************/

// mainframe.cpp

#include <wx/wxprec.h>
 
#ifdef __BORLANDC__
    #pragma hdrstop
#endif
 
#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif

#include <wx/xrc/xmlres.h>



BEGIN_EVENT_TABLE(MainFrame, wxFrame)
    //EVT_BUTTON(XRCID("button_test"), MainFrame::OnButtonTest)
END_EVENT_TABLE()



MainFrame::MainFrame(wxWindow* parent)
{
    wxXmlResource::Get()->LoadFrame(this, parent, _("frame"));
}
 
MainFrame::~MainFrame()
{
}


 
Px @ 2005-12-26 23:07

SHELL = /bin/sh
CC = cc
CXX = g++

LIBDIR = ----------------------------
INCDIR = -----------------------------

CFLAGS = -g -Wall
CPPFLAGS = $(CFLAGS) -I$(INCDIR)
LDFLAGS = -L$(LIBDIR)
LDLIBS = --------------------------------
FLAGS = $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)

all : sender receiver

sender : example1.cpp
    $(CXX) -o $@ $(FLAGS) $^

receiver : example3.cpp
    $(CXX) -o $@ $(FLAGS) $^


 
Px @ 2005-11-10 22:01

抽象类的作用:
有些类生成对象是不合情理的

虚函数的缺点:
效率和多占一个指针的空间



 
Px @ 2005-11-05 00:31

1. 尽量用编译器而不用预处理
 1) const Vs. #define
   #define被预处理,所以定义的名字不会加入到符号列表中。在编译时出错和符号调试器中,无法确定所代表的具体含义。
   const的作用更大,可以定义指针常量,某个类的常量等等。

 2) inline Vs. #define
   inlene可以实现宏的效率,而且有可预计的行为和类型安全等优点。

2. 使用<iostream>代替<stdio.h>
 scanf和printf很轻巧,很高效,但不是类型安全的,而且没有扩展性。

3. new, delete Vs. malloc, free
 问题:malloc和free不知道构造函数和析构函数。

4. 尽量使用c++风格的注释
  例外:#define light_speedp 3e8 // m/sec (in a vacuum)


 
网志文件夹
所有网志
Linux
JAVA
研究相关
C/C++
杂项
最 新 的 评 论
日 历

搜 索
友 情 链 接
· 歪酷博客 · 管理我的Blog ·

订阅 RSS

0011565

歪酷博客