comp.lang.ada
 help / color / mirror / Atom feed
* Ada Leaking Into Day Job
@ 2010-03-19 17:24 Warren
  2010-03-19 21:53 ` Adam Beneschan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Warren @ 2010-03-19 17:24 UTC (permalink / raw)


Heh, heh... today I got several COBOL compile
errors, telling me that Ada is leaking into my
day job:

    ...
    END EVALUATE

(Should be END-EVALUATE)

    IF RET-CODE /= 0 THEN

(you get the idea). I never had this problem with
C/C++ :)

Warren



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-19 17:24 Ada Leaking Into Day Job Warren
@ 2010-03-19 21:53 ` Adam Beneschan
  2010-03-21  0:21   ` Björn Persson
  2010-03-22  9:53 ` Gautier write-only
  2010-03-22 16:55 ` KarlNyberg
  2 siblings, 1 reply; 8+ messages in thread
From: Adam Beneschan @ 2010-03-19 21:53 UTC (permalink / raw)


On Mar 19, 10:24 am, Warren <ve3...@gmail.com> wrote:
> Heh, heh... today I got several COBOL compile
> errors, telling me that Ada is leaking into my
> day job:
>
>     ...
>     END EVALUATE
>
> (Should be END-EVALUATE)
>
>     IF RET-CODE /= 0 THEN
>
> (you get the idea). I never had this problem with
> C/C++ :)

I wonder how many programmers have had Ada leak into their C/C++ and
have written something like

   if (code /= 0) { ... }

This is valid C, so the compiler won't complain, but it will not quite
do what you want.

:)
                       -- Adam



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-19 21:53 ` Adam Beneschan
@ 2010-03-21  0:21   ` Björn Persson
  2010-03-22 15:18     ` Warren
  0 siblings, 1 reply; 8+ messages in thread
From: Björn Persson @ 2010-03-21  0:21 UTC (permalink / raw)


Adam Beneschan wrote:

>    if (code /= 0) { ... }
> 
> This is valid C, so the compiler won't complain

Are you sure? ;-)

int main(int argc, char** argv) {
   int code = 1;
   if(code /= 0) {
      return 1;
   }
   return 0;
}

[beorn@hactar tester]$ LANG=en gcc ada_not_equal.c 
ada_not_equal.c: In function 'main':
ada_not_equal.c:3: warning: division by zero

That's even without the otherwise indispensable -Wall.

The problem I have most often when I switch languages is that I get =, := 
and == mixed up.

-- 
Bj�rn Persson
PGP key A88682FD




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-19 17:24 Ada Leaking Into Day Job Warren
  2010-03-19 21:53 ` Adam Beneschan
@ 2010-03-22  9:53 ` Gautier write-only
  2010-03-22 16:55 ` KarlNyberg
  2 siblings, 0 replies; 8+ messages in thread
From: Gautier write-only @ 2010-03-22  9:53 UTC (permalink / raw)


It is more the "Ada style" that has leaked in my VB coding, like

    Sub Mix(ByVal code As Char, ....
        ' declarations here and not scattered anywhere...
        Dim li As String
        Dim bid As String
        Dim fi, fo As Integer
        Dim first_line As Boolean
        ' begin
        first_line = True
        '
        fi = FreeFile()
        FileOpen(fi, name_1, OpenMode.Input)
        While Not EOF(fi)
          ...

Now I've simplified things, making GCC leaking itself into the day
job :-).
G.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-21  0:21   ` Björn Persson
@ 2010-03-22 15:18     ` Warren
  0 siblings, 0 replies; 8+ messages in thread
From: Warren @ 2010-03-22 15:18 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

Bj�rn Persson expounded in news:80l74nFptU1@mid.individual.net:

> Adam Beneschan wrote:
> 
>>    if (code /= 0) { ... }
>> 
>> This is valid C, so the compiler won't complain
> 
> Are you sure? ;-)
> 
> int main(int argc, char** argv) {
>    int code = 1;
>    if(code /= 0) {
>       return 1;
>    }
>    return 0;
> }
> 
> [beorn@hactar tester]$ LANG=en gcc ada_not_equal.c 
> ada_not_equal.c: In function 'main':
> ada_not_equal.c:3: warning: division by zero
> 
> That's even without the otherwise indispensable -Wall.
> 
> The problem I have most often when I switch languages is that I get =,
> := and == mixed up.

Yep, I've been having to backspace over some := in my
awk scripts lately also.

Warren



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-19 17:24 Ada Leaking Into Day Job Warren
  2010-03-19 21:53 ` Adam Beneschan
  2010-03-22  9:53 ` Gautier write-only
@ 2010-03-22 16:55 ` KarlNyberg
  2010-03-22 17:07   ` Gautier write-only
  2 siblings, 1 reply; 8+ messages in thread
From: KarlNyberg @ 2010-03-22 16:55 UTC (permalink / raw)


Yeah, I had one of these drive me bonkers for a while:

for (i = 0; i < something; i++);
    {
         /* something here */
    }

Always executed ONCE...  Even when it wasn't supposed to! :-(




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-22 16:55 ` KarlNyberg
@ 2010-03-22 17:07   ` Gautier write-only
  2010-03-24 21:48     ` Gautier write-only
  0 siblings, 1 reply; 8+ messages in thread
From: Gautier write-only @ 2010-03-22 17:07 UTC (permalink / raw)


On 22 Mrz., 17:55, KarlNyberg:
> Yeah, I had one of these drive me bonkers for a while:
>
> for (i = 0; i < something; i++);
>     {
>          /* something here */
>     }
>
> Always executed ONCE...  Even when it wasn't supposed to! :-(

That's more a typical C annoyance (there was a funny list about that).
Should not come from typing Ada code (not ';' after for ... loop)
G.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Leaking Into Day Job
  2010-03-22 17:07   ` Gautier write-only
@ 2010-03-24 21:48     ` Gautier write-only
  0 siblings, 0 replies; 8+ messages in thread
From: Gautier write-only @ 2010-03-24 21:48 UTC (permalink / raw)


> On 22 Mrz., 17:55, KarlNyberg:
>
> > Yeah, I had one of these drive me bonkers for a while:
>
> > for (i = 0; i < something; i++);
> >     {
> >          /* something here */
> >     }
>
> > Always executed ONCE...  Even when it wasn't supposed to! :-(
>
> That's more a typical C annoyance (there was a funny list about that).

A nice of such lists: "The Top 10 Ways to get screwed by the "C"
programming language"
http://www.andromeda.com/people/ddyer/topten.html
Your "';' before {}" belongs to the #8 one...



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-03-24 21:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-19 17:24 Ada Leaking Into Day Job Warren
2010-03-19 21:53 ` Adam Beneschan
2010-03-21  0:21   ` Björn Persson
2010-03-22 15:18     ` Warren
2010-03-22  9:53 ` Gautier write-only
2010-03-22 16:55 ` KarlNyberg
2010-03-22 17:07   ` Gautier write-only
2010-03-24 21:48     ` Gautier write-only

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox