'Study../Programming'에 해당되는 글 17건

  1. 2009.05.29 no newline at end of file
  2. 2008.10.28 Javascript 계산기
linux 로 gcc 환경에서 컴파일 해보면 가끔 no newline at end of file 이라는 warning을 발견 할 수 있다네요... 
(저도 발견했다가 찾아서 해결하는 방법도 찾은.. ) 

gcc.gnu.org 에 따르면, 
include를 하거나 함수 리턴에 의하여 뒤에 실행되어야 할 내용이 있음에도 불구하고
그것을 종료시켰을때. 일어나는 워닝 이라고 하는데... 
(맞게 해석한거 맞어..? ;; ) 

괜히 (잘못된? ) 불필요한 return 등을 달았을때 발생 하는거 같네요. 
(저는 받은 코드에서 return을 제거하니 되더라는. ) 

아래는 위 사이트에서 한 설명입니다. 


> What is the rationale for this warning ? What can break or is it a
> standards thing ?

Imagine foo.h:

blah blah blah<no newline>

Now bar.c:

#include "foo.h"
#include "grill.h"

Now imagine a preprocessor that isn't smart enough to put
the newline in for you...

blah blah blah#include "grill.h"

It may not include grill.h.

'Study.. > Programming' 카테고리의 다른 글

linux 에서 실행시간 확인 하기..  (0) 2009.06.30
race condition ( thread, mutex, semaphore)  (0) 2009.05.29
Javascript 계산기  (0) 2008.10.28
printf 의 16진수 / 8진수 출력..  (0) 2008.09.18
Intelligent completion at Vim 7.0  (0) 2008.06.03
Posted by Yoons...
,


[code]<html>
<head>
<script type="text/javascript">
function plus() {
temp.value = num.value ; type.value = 1; num.value = "" }
function minus() {
temp.value = num.value ; type.value = 2; num.value = "" }
function mul() {
temp.value = num.value ; type.value = 3; num.value = "" }
function div() {
temp.value = num.value ; type.value = 4; num.value = "" }

function get_result() {
if(type.value==1) {num.value = parseInt(temp.value) + parseInt(num.value);}
if(type.value==2) {num.value = parseInt(temp.value) - parseInt(num.value);}
if(type.value==3) {num.value = parseInt(temp.value) * parseInt(num.value);}
if(type.value==4) {num.value = parseInt(temp.value) / parseInt(num.value);}
temp.value = "";
}

</script>
</head>

<body>
<input type="text" size="10" id="num"><br>
<input type="button" value="+" onclick="plus()">
<input type="button" value="-" onclick="minus()">
<input type="button" value="*" onclick="mul()">
<input type="button" value="/" onclick="div()"><br>
<input type="button" value="      =      " onclick="get_result()">
<input type="hidden" size="10" id="temp">
<input type="hidden" size="10" id="type">
</body>
</html>[/code]


 html 기반의 Javascript 를 이용한 계산기.

w3c school 참조 하였으며,
결과값을 이용한 연속 연산도 가능하도록 되어 있고,
JS 특성상 zero divisor 등에 대해서도 무한대 결과 출력이라던가,
정상적인 값이 아니면 non 이 뜨는 등 에러 처리도 된다.

(첫번째꺼 빼고는 ) 내가 일일이 다 구현한 것도 아니지만
JS 라서 다 된다...  -_-;;;



신기하다.
인터넷 응용프로그래밍 중간고사 치고 나니깐...
JS 로 뭔가 만드는게 좀 주저함이 많이 없어졌다.
이번에 중간고사때 실제 손 코딩은 처음 해봤는데도 이런다. ;;;

'Study.. > Programming' 카테고리의 다른 글

race condition ( thread, mutex, semaphore)  (0) 2009.05.29
no newline at end of file  (0) 2009.05.29
printf 의 16진수 / 8진수 출력..  (0) 2008.09.18
Intelligent completion at Vim 7.0  (0) 2008.06.03
_beginthreadex  (2) 2007.11.16
Posted by Yoons...
,