CONSTµÄÏà¹Ø¼¸¸öÎÊÌâ½â´ð£¨cÓëc++£¬java£©
Ò»¡¢
ÏÈ¿´Ò»¸ö³ÌÐò
#include <stdio.h>
int main()
{
const int a = 5;
int b[a];
return 0;
}
ÔÚvc6.0ÖÐÃüÃûΪ.cÎļþ£¬±àÒë»á³ö´í£¬ÊÇint b[a]ÕâÒ»ÐУºexpected constant expression
ÃüÃûΪ.cppÎļþ£¬Ã»ÎÊÌâ¡£
ÔÚcodeblocks(Ò»¸öÃâ·Ñ¿ªÔ´µÄ±àÒëÆ÷)ÖбàÒ붼ûÎÊÌâ
»¹ÓÐÒ»¸ö³ÌÐò
#include <stdio.h>
int main()
{
const int a = 5;
int b = 4;
switch (b)
{
case 3:
case a:
case 4:
printf("asdf");
break;
}
return 0;
}
ÔÚvc6.0ÖÐÃüÃûΪ.cÎļþ£¬±àÒë»á³ö´í£¬ÊÇcase a:ÕâÒ»ÐУºcase expression not constant
ÃüÃûΪ.cppÎļþ£¬Ã»ÎÊÌâ¡£
ÔÚcodeblocksÖÐн¨c¹¤³ÌÎļþ±àÒë»á³ö´í£¬Ð½¨c++¹¤³ÌÎļþ²»»á³ö´í¡£
½â´ð£º
Chiyer¡¿:
constÊÇÒ»¸öCÓïÑԵĹؼü×Ö£¬ËüÏÞ¶¨Ò»¸ö±äÁ¿²»ÔÊÐí±»¸Ä±ä¡£Ê¹ÓÃconstÔÚÒ»¶¨³Ì¶ÈÉÏ¿ÉÒÔÌá¸ß³ÌÐòµÄ½¡×³ÐÔ£¬ÁíÍ⣬ÔÚ¹Û¿´±ðÈË´úÂëµÄʱºò£¬ÇåÎúÀí½âconstËùÆðµÄ×÷Ó㬶ÔÀí½â¶Ô·½µÄ³ÌÐòÒ²ÓÐһЩ°ïÖú¡£
ËäÈ»ÕâÌýÆðÀ´ºÜ¼òµ¥£¬µ«Êµ¼ÊÉÏ£¬constµÄʹÓÃÒ²ÊÇcÓïÑÔÖÐÒ»¸ö±È½Ï΢ÃîµÄµØ·½£¬Î¢ÃîÔںδ¦ÄØ£¿Çë¿´ÏÂÃ漸¸öÎÊÌâ¡£
¡¡¡¡ÎÊÌ⣺const±äÁ¿ & ³£Á¿
¡¡¡¡ÎªÊ²Ã´ÎÒÏóÏÂÃæµÄÀý×ÓÒ»ÑùÓÃÒ»¸öconst±äÁ¿À´³õʼ»¯Êý×飬ANSI CµÄ±àÒëÆ÷»á±¨¸æÒ»¸ö´íÎóÄØ£¿
¡¡¡¡const int n = 5;
¡¡¡¡int a[n];
¡¡¡¡1)¡¢Õâ¸öÎÊÌâÌÖÂÛµÄÊÇ“³£Á¿”Óë“Ö»¶Á±äÁ¿”µÄÇø±ð¡£³£Á¿¿Ï¶¨ÊÇÖ»¶ÁµÄ£¬ÀýÈç5£¬ “abc”£¬µÈ£¬¿Ï¶¨ÊÇÖ»¶ÁµÄ£¬ÒòΪ³ÌÐòÖиù±¾Ã»Óеط½´æ·ÅËüµÄÖµ£¬µ±È»Ò²¾Í²»Äܹ»È¥ÐÞ¸ÄËü¡£¶ø“Ö»¶Á±äÁ¿”ÔòÊÇÔÚÄÚ´æÖпª±ÙÒ»¸öµØ·½À´´æ·ÅËüµÄÖµ£¬Ö»²»¹ýÕâ¸öÖµÓɱàÒëÆ÷ÏÞ¶¨²»ÔÊÐí±»Ð޸ġ£CÓïÑԹؼü×Öconst¾ÍÊÇÓÃÀ´ÏÞ¶¨Ò»¸ö±äÁ¿²»ÔÊÐí±»¸Ä±äµÄÐÞÊηû(Qualifier)¡£ÉÏÊö´úÂëÖбäÁ¿n±»ÐÞÊÎΪֻ¶Á±äÁ¿£¬¿ÉϧÔÙÔõôÐÞÊÎÒ²²»Êdz£Á¿¡£¶øANSI C¹æ¶¨Êý×鶨Òåʱά¶È±ØÐëÊÇ“³£Á¿”£¬“Ö»¶Á±äÁ¿”Ò²ÊDz»¿ÉÒԵġ£
¡¡¡¡2)¡¢×¢Ò⣺ÔÚANSI CÖУ¬ÕâÖÖд·¨ÊÇ´íÎóµÄ£¬ÒòΪÊý×éµÄ´óСӦ¸ÃÊǸö³£Á¿£¬¶øconst int n,nÖ»ÊÇÒ»¸ö±äÁ¿(³£Á¿ != ²»¿É±äµÄ±äÁ¿£¬µ«ÔÚ±ê×¼C++ÖУ¬ÕâÑù¶¨ÒåµÄÊÇÒ»¸ö³£Á¿£¬ÕâÖÖд·¨ÊǶԵÄ)£¬Êµ¼ÊÉÏ£¬¸ù¾Ý±àÒë¹ý³Ì¼°ÄÚ´æ·ÖÅäÀ´¿´£¬ÕâÖÖÓ
Ïà¹ØÎĵµ£º
package com.chinacache.boss.queryservice.service.impl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.chinacache.boss.queryservice.excepti ......
//¾²Ì¬¿é£¨static block£©£ºÈçÏÂËùʾ
public class StaticBlock1
{
static
{
System.out.println("static block");
......
Database
MySQL
PostgreSQL
Firebird(suitable for embedded database)
HSQLDB(160K)
DB Tie
Hibernate
Ibatis
JDO
OSCache
JBossCache
Business Tie
Spring
UI Tie
Structs
JSF
Tapestry
Webwork
Flex
DWR(Ajax
Framework)
ZK(Ajax
Framework)
Dojo(Ajax
Framework)
Development Tools
......
unixϵͳ£º´ò¿ªshellÃüÁîÐÐ
ÊäÈëvi _bash_profile ÐÞ¸Ä
JA ......
ÐÅÔë±È( S N )ÊÇÖ¸´«ÊäÐźŵÄƽ¾ù¹¦ÂÊÓë¼ÓÐÔÔëÉùµÄƽ¾ù¹¦ÂÊÖ®±È¡£
ÔØÔë±È(C N )Ö¸ÒѾµ÷ÖƵÄÐźŵÄƽ¾ù¹¦ÂÊÓë¼ÓÐÔÔëÉùµÄƽ¾ù¹¦ÂÊÖ®±È¡£
ËüÃÇͨ³£¶¼ÒÔ¶ÔÊýµÄ·½Ê½À´¼ÆË㣬µ¥Î»ÎªdB¡£
ÐÅÔë±ÈÓëÔØÔë±ÈÇø±ðÔÚÓÚ£¬ÔØÔë±ÈÖÐÒѵ÷ÐźŵŦÂÊ°üÀ¨ÁË´«ÊäÐźŵŦÂʺ͵÷ÖÆÔز¨µÄ¹¦ÂÊ£¬¶øÐÅÔë±ÈÖнö°üÀ¨´«ÊäÐźŵŦÂÊ£¬Á½ÕßÖ®¼äÏà²îÒ ......