In C, func() and func(void) have different function signature.
(But, in C++, these two are same.)

'func()' means 'this function can have any number of arguments (0 ~ infinite)'.
But, 'func(void)' means 'this function doesn't have argument.'
See following example.

#ifdef CASE1
void func(void); /* (1) */
#else
void func();     /* (2) */
#endif

void
func(int i) {
        ; /* do something */
}

If 'CASE1' is defined, compiling this file complains error like "error: conflicting types for 'func'".
But, 'CASE1' is not defined, this is well-compiled.
Now, you can clearly understand difference.

So, using 'func(void)' is better for readibility if 'func' really doesn't have any arguement, instead of just 'func()'.

*** One more. ***
In C, 'extern' for function is default visibility.
So, in function declaration, 'extern void func(void);' is exactly same with 'void func(void);'.
Therefore any of them is OK.
( [ omitting 'extern' for simplicity ] vs. [ using 'extern' to increase readability ] )
But, default visibility of function depends on compiler.
For portability reason, using macro is usually better instead of using explicit directive - especially at shared library header.
(Ex. 'EXTERN void func(void)')

넘버즈 전 시즌(1~6)을 정주행 했다. 음~ 뭐랄까... 볼만은 했으나, 강추까지는 아닌...
수학천재인 동생(찰리 앱스)과, FBI인 형(돈 앱스) 이렇게 두 사람이 이야기의 중심이 되는데... 동생이 수학을 이용해서 FBI의 수사를 돕는다는 내용이다.
뭐, 사실 모든 드라마가 그러하듯 현실성이 떨어지긴 하지만 (아무리 천재라곤 하지만 그 짧은 시간에 정의하기도 힘든 조건들을 가지고 수학적인 답을 얻어내는건... 도저히 이해할 수 없다...-_-; ), 어쨌든 아무 생각없이 보고 있으면, 그냥 꽤 괜찮은 수사물 정도로 볼 수도 있겠다.
후반 시즌으로 갈수록 시청률 저하때문에 고생했다고 하지만 (당연한건가?), 개인적으로는 전반부보다 후반부가 더 나았다.
단순한 수사물이였던 전반부에 비해서, 후반부에는 인간으로서 가질 수 있는 여러가지 고뇌들과 삶의 철학적인 내용이 묻어 나온다.

등장인물들의 일관성이 부족하고 - 왜 나왔는지 의미없이 잠깐씩 나왔다가 더 이상 등장하지 않는 인물들 - 큰 흐름에서 보았을때의 유기성은 좀 떨어지는 것 같으나, 등장 인물의 캐릭터 설정이 상당히 괜찮았던것 같다.
특히... 물리학 교수이자 찰리 앱스의 스승인 래리 플레인하르 교수의 존재감이란...^^;

이런 옴니버스식 드라마의 특징이라고 할 수도 있겠지만 전체적인 스토리의 깊이가 없어서 어느 정도 지나면 슬슬 지겨워 진다.
대신 소재가 무한정하니까, 시리즈를 길게 가져갈 수 있다는 장점이 있겠지만...

여튼 전체적으로 "볼만하다"라는 평을 하고 싶다.

'Essay > Review' 카테고리의 다른 글

[Review][Game] 총망라...  (0) 2011.11.23
[Review] 삼국군영전5  (0) 2011.11.23
[Review][Game] Growlancer (그로우랜서1)  (0) 2011.08.23
[Review] Extreme Programming Explained 2/E  (0) 2011.08.05
[Review] Kingdom Under Fire - Gold Edition  (1) 2011.08.05

GNU Global(henceforth Global) is good tagging tool.
In Global, user can add file or directory list to skip during parsing in the configuration file (~/.globalrc by default).

[ Customization 1 ]
But, in case of monster-like-huge-system, this file list becomes too big and complex.
So, one of my option to resolve this issue is "Using regular expression(henceforth regex.) directly in the configuration file."

To do this, source code of Global should be modified, definitely.
Following source code diff. is based on GNU Global 5.9.7

diff --git a/libutil/find.c b/libutil/find.c
index aa12e81..a49bcdf 100644
--- a/libutil/find.c
+++ b/libutil/find.c
@@ -263,9 +263,18 @@ prepare_skip(void)
                char *skipf = p;
                if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL)
                        *p++ = 0;
+               /*
+                * [ Modification For My Private Usage! ]
+                * string starts with '/' is treated as regular expression.
+                * (Not file name!)
+                */
                if (*skipf == '/') {
-                       list_count++;
-                       strbuf_puts0(list, skipf);
+                       reg_count++;
+                       /* put it as it is as regular expression! */
+                       for (q = skipf + 1; *q; q++)
+                               strbuf_putc(reg, *q);
+                       if (p)
+                               strbuf_putc(reg, '|');
                } else {
                        reg_count++;
                        strbuf_putc(reg, '/');
@@ -288,6 +297,8 @@ prepare_skip(void)
                /*
                 * compile regular expression.
                 */
+               printf("********* skip regular expression ***********\n%s\n"
+                      ,strbuf_value(reg));
                skip = &skip_area;
                retval = regcomp(skip, strbuf_value(reg), flags);
                if (retval != 0)

Global keeps its skip list with following form.

(/<path0>|/<path1> ...)

And characters that can be used as regex. is replaced with leading escape character '\'.
So, all characters are treated as character itself and don't have meta meaning during regex. compilation.
To use regex. directly, modifying this code area is required and above diff. is for this.
Another thing to know to use regex. directly is that file path that is used in Global for parsing always starts with './'

Original Global supports absolute path.
But, in my case, it was almost useless.
So, instead of using absolute path, I modified it to use this for regex. syntax.
That is, syntax for absolute path is used as the one for regex. of configuration file in modified Global.
(printf is for debugging configuration file. :-) )

Here is example at the modified version.
(Leading automatically-added-default-expression  is omitted.)

Standard case
-------------

[ Configuration ]
:skip=tags,project/bin/,/b[0-9]+\.txt$:

[ Regular expression string ]
(/tags$|/project/bin/)

=> absolute path is stored at other list - not in regex.

Customized case
---------------

[ Configuration ]
 :skip=tags,project/bin/,/b[0-9]+\.c:

[ Regular expression string ]
(/tags$|/project/bin/|b[0-9]+.txt$)

[ Customization 2 ]

There is no well-described official document about Global configuration file.
So, I'm not sure that following case is intentional or not.

In configuration file, default leading string of regex. is '/'.
That is, "skip=build/:" is transformed to "/build/" in regex.
Therefore, this matches not only "./build" but also "xxxxx/build/xxxxx".
But this always confused me.
So, let me introduce modification to overcome this.

--- a/libutil/find.c
+++ b/libutil/find.c
@@ -277,7 +277,10 @@ prepare_skip(void)
                                strbuf_putc(reg, '|');
                } else {
                        reg_count++;
-                       strbuf_putc(reg, '/');
+                       /*
+                        * all local files are started with './'
+                        */
+                       strbuf_puts(reg, "^\\./");
                        for (q = skipf; *q; q++) {
                                if (isregexchar(*q))
                                        strbuf_putc(reg, '\\');

This means, "all file path is relative path from gtags' root."
For me, this is much better and clearer than original version.

Enjoy!

'Tools' 카테고리의 다른 글

[ Emacs ] key-bindings.... (my environment)  (0) 2012.03.23
Interesting rule of GNU make.  (0) 2012.03.23
[Tools] 'Tab' means 'Command' in Make.  (0) 2011.01.26
[Emacs] use Semantic with global...  (0) 2010.06.29
[Tool] gnumake...  (0) 2010.02.19

+ Recent posts