2010년 3월 18일 목요일

[STL::Map] Error occured

#include <iostream>
#include <map>

int main()
{
 std::map<int, int> mapTest ;
 
 for (int i = 0 ; i <10 ; i++)
 {
  mapTest[i] = 10*i ;
 }
 std::map<int, int>::iterator mapIt ;

 mapIt = mapTest.find(10) ;


 /*
 if (mapIt != NULL)
  std::cout << "mapIt = " << mapIt->second << std::endl ;
 */ // Error occur: the iterator might not find out its error.


if (mapIt != mapTest.end())
  std::cout << "mapIt = " << mapIt->second << std::endl ;

 int i ;
 std::cin >> i ;

 return 0 ;
}




My friend saw my source code, and adviced to me that the code will be broken from map's iterator.

So, I simply tested this source. I could find out where the problem occured.

However, I can't explain why the error occurs. I need to study about STL, especially map.




- ps.
This blog is for my English abilities, and I'm not good at communicating in English. If you see grammatic, syntax or logical errors, or if you can't understand clearly, PLEASE COMMENT ON IT. Your comments definitely help me, and I will really appreciate this. :)



2010년 2월 18일 목요일

[Janurary 28, 2010] my journal




It's deep dawn. I smoked one of cigarrets.
I'm so sad because the time is going too fast and it's almost the last part of January..
What was I doing? Since I came back to my home town, I've wasted a lot of time to rest.
My two main subjects, programming and studying English, have been blocked.

Maybe, it's my life style to regret something always..
Our time is limited, but my resolutions and my works appear every time.
That would be why I become always sad.

I'm afraid of my future..
Something talks to me it's going to be fine, but sometimes it's going to be just my imaginations..
Here in my country, going abroad other countries to work is not simple.
Sometimes, I agreed what I should work in Korea. Maybe.. Many times I did..
To go to the United State for working? It's really one of the ridingculas imaginations..


Although I have these ideas, I still dream..
It's about future, girl's issues, my honourable states or money.
On my hands, there is nothing to have.
I don't have these things, but I still dream.
Because I don't have anything, I still dream.
It would be the reason why I'm here, why I study and why I try...





- ps.
This blog is for my English abilities, and I'm not good at communicating in English. If you see grammatic, syntax or logical errors, or if you can't understand clearly, PLEASE COMMENT ON IT. Your comments definitely help me, and I really appreciate this. :)

- Written by Gordon


2010년 1월 23일 토요일

[January 23, 2010] a font for programming

 

 

 Few days ago, when I studied MFC programming throught a web lecture, the teacher recommented to use the font of 'Consolas' which was developed by Microsoft for developers. Also, it's optimized for Microsoft Visual Studio 2005 & 2008 so that Simply I changed one option.

 

Here is the capture of Consolas font on Visual Studio 2008.

 

 

 

This is the capture of alphabet using Consolas.

 

 

 

You can download on the web site of MS page.

Here is a link:

http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&displaylang=en

 

 

Enjoy coding :)

 

 

 

 

- ps.
This blog is for my English abilities, and I'm not good at communicating in English. If you see grammatic, syntax or logical errors, or if you can't understand clearly, PLEASE COMMENT ON IT. Your comments definitely help me, and I really appreciate this. :)

 

- Written by Gordon

 

 

2010년 1월 13일 수요일

[News] Web 2.0 Suicide Machine

 

 

From NPR.

Here is the Link:

http://www.npr.org/templates/story/story.php?storyId=122379695

 

 

 

- Vocabraries (that were new to me):

 

 

fritter: make something into frit

fritter away: to waste time.

 

coax: persuade gently, gently make something work

 

euthanasia: painless killing to relieve suffering

 

violate: disregard something, disturb something

 

investigate: carry out official inquiry, take look

 

 

 

 

- My opinion:

That's why I don't use or visit in social-networking web sites. I highly recomment it.

 

 

 

 

 

2010년 1월 4일 월요일

[Scrap] Struct SYSTEM_INFO (System Programming)


It's from MSDN, and here is the link:
http://msdn.microsoft.com/en-us/library/ms724958(VS.85).aspx



SYSTEM_INFO Structure

Contains information about the current computer system. This includes the architecture and type of the processor, the number of processors in the system, the page size, and other such information.

Syntax

C++
typedef struct _SYSTEM_INFO {
  union {
    DWORD dwOemId;
    struct {
      WORD wProcessorArchitecture;
      WORD wReserved;
    } ;
  } ;
  DWORD     dwPageSize;
  LPVOID    lpMinimumApplicationAddress;
  LPVOID    lpMaximumApplicationAddress;
  DWORD_PTR dwActiveProcessorMask;
  DWORD     dwNumberOfProcessors;
  DWORD     dwProcessorType;
  DWORD     dwAllocationGranularity;
  WORD      wProcessorLevel;
  WORD      wProcessorRevision;
}SYSTEM_INFO;

Members

dwOemId

An obsolete member that is retained for compatibility. Applications should use the wProcessorArchitecture branch of the union.

wProcessorArchitecture

The processor architecture of the installed operating system. This member can be one of the following values.

Value Meaning
PROCESSOR_ARCHITECTURE_AMD64
9

x64 (AMD or Intel)

PROCESSOR_ARCHITECTURE_IA64
6

Intel Itanium Processor Family (IPF)

PROCESSOR_ARCHITECTURE_INTEL
0

x86

PROCESSOR_ARCHITECTURE_UNKNOWN
0xffff

Unknown architecture.

 

wReserved

This member is reserved for future use.

dwPageSize

The page size and the granularity of page protection and commitment. This is the page size used by the VirtualAlloc function.

lpMinimumApplicationAddress

A pointer to the lowest memory address accessible to applications and dynamic-link libraries (DLLs).

lpMaximumApplicationAddress

A pointer to the highest memory address accessible to applications and DLLs.

dwActiveProcessorMask

A mask representing the set of processors configured into the system. Bit 0 is processor 0; bit 31 is processor 31.

dwNumberOfProcessors

The number of physical processors in the system. To retrieve the number of logical processors, use the GetLogicalProcessorInformation function.

dwProcessorType

An obsolete member that is retained for compatibility. Use the wProcessorArchitecture, wProcessorLevel, and wProcessorRevision members to determine the type of processor.

Name Value

PROCESSOR_INTEL_386

386

PROCESSOR_INTEL_486

486

PROCESSOR_INTEL_PENTIUM

586

PROCESSOR_INTEL_IA64

2200

PROCESSOR_AMD_X8664

8664

 

dwAllocationGranularity

The granularity for the starting address at which virtual memory can be allocated. For more information, see VirtualAlloc.

wProcessorLevel

The architecture-dependent processor level. It should be used only for display purposes. To determine the feature set of a processor, use the IsProcessorFeaturePresent function.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_INTEL, wProcessorLevel is defined by the CPU vendor.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_IA64, wProcessorLevel is set to 1.

wProcessorRevision

The architecture-dependent processor revision. The following table shows how the revision value is assembled for each type of processor architecture.

Processor Value
Intel Pentium, Cyrix, or NextGen 586 The high byte is the model and the low byte is the stepping. For example, if the value is xxyy, the model number and stepping can be displayed as follows:

Model xx, Stepping yy

Intel 80386 or 80486 A value of the form xxyz.

If xx is equal to 0xFF, y - 0xA is the model number, and z is the stepping identifier.

If xx is not equal to 0xFF, xx + 'A' is the stepping letter and yz is the minor stepping.

 

Examples

For an example, see Getting Hardware Information.

Requirements

Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header Winbase.h (include Windows.h)