Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #144918

Re: Switching to C#

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c, comp.lang.c++
Subject Re: Switching to C#
Date 2019-06-16 12:23 +0200
Organization A noiseless patient Spider
Message-ID <qe55am$s8p$1@dont-email.me> (permalink)
References (1 earlier) <OyiME.971$fv7.530@fx08.fr7> <qe04ln$a3u$1@dont-email.me> <5d03bb38.3305609877@core> <qe37jf$tie$1@news.albasani.net> <5d059fdf.3429680737@core>

Cross-posted to 2 groups.

Show all headers | View raw


On 16/06/2019 03:58, Scott wrote:
> On Sat, 15 Jun 2019 18:49:52 +0200, Bonita Montero
> <Bonita.Montero@gmail.com> wrote:
> 
>>>> You don't have to declare everything before you use it.
>>
>>> Many people, including myself, consider that to be a bad thing.
>>
>> With todays IDEs it's not a pain when there aren't any forward
>> -declarations. Just right-click at the symbol and click the
>> option to guide to the definition.
>> I like C++ but I don't think forward-declarations are an adantage.
> 
> There are ways. Long ago I wrote an assembler that avoided forward
> declarations by making two passes over the source. C doesn't do that,
> for reasons.
> 
> C does allow implicit declarations. You can call a previously
> undeclared function, and C will trust that the types you're passing
> are the types the function's expecting. I think it's a bad idea, and
> it usually yields warnings suggesting that it's a bad idea. I think
> any form of implicit typing is a bad idea.
> 

It is worth being clear here that implicit declarations don't let you 
use functions properly before declaring them.  When a function is used 
with an implicit declaration, it is treated as taking an unknown number 
of unknown type parameters, using default argument promotions, and 
returning an int.  If there is a definition (or prototype declaration) 
of the function found later in the code, the compiler does not go back 
and correct the earlier usage.  So as you say, relying on implicit 
declarations is a bad idea.


It is also important to note that C++ is a bit more flexible here.  When 
declaring a class, functions declared within the class can refer to 
members and functions that are declared later in the class.  And 
template code can refer to identifiers declared later on (as long as 
they are declared before the template is invoked).

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-12 11:01 -0400
  Re: Switching to C# fir <profesor.fir@gmail.com> - 2019-06-12 08:21 -0700
  Re: Switching to C# Szyk Cech <szykcech@spoko.pl> - 2019-06-12 17:32 +0200
    Re: Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-12 12:04 -0400
      Re: Switching to C# Szyk Cech <szykcech@spoko.pl> - 2019-06-13 05:50 +0200
    Re: Switching to C# fir <profesor.fir@gmail.com> - 2019-06-13 15:43 -0700
  Re: Switching to C# gazelle@shell.xmission.com (Kenny McCormack) - 2019-06-12 16:30 +0000
    Re: Switching to C# My nuts hurt <cdalten@gmail.com> - 2019-06-13 09:54 -0700
    Re: Switching to C# Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> - 2019-06-14 15:28 +0000
      Re: Switching to C# gazelle@shell.xmission.com (Kenny McCormack) - 2019-06-14 15:55 +0000
        Re: Switching to C# rick.c.hodgin@gmail.com - 2019-06-14 10:25 -0700
          Re: Switching to C# scott@slp53.sl.home (Scott Lurndal) - 2019-06-14 17:56 +0000
            Whatever will we do without Rick??? (Was: Switching to C#) gazelle@shell.xmission.com (Kenny McCormack) - 2019-06-14 18:02 +0000
              Re: Whatever will we do without Rick??? (Was: Switching to C#) rick.c.hodgin@gmail.com - 2019-06-14 12:24 -0700
            Re: Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-14 14:24 -0400
      Re: Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-14 12:57 -0400
        Re: Switching to C# Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-06-15 01:29 +0100
  Re: Switching to C# "Chris M. Thomasson" <invalid_chris_thomasson_invalid@invalid.com> - 2019-06-12 17:17 -0700
    Re: Switching to C# "Chris M. Thomasson" <invalid_chris_thomasson_invalid@invalid.com> - 2019-06-12 23:41 -0700
  Re: Switching to C# Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-06-13 03:30 +0100
    Re: Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-14 08:43 -0400
      Re: Switching to C# nobody@example.org (Scott) - 2019-06-14 15:21 +0000
        Re: Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-14 12:55 -0400
          Re: Switching to C# Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-06-15 01:28 +0100
        Re: Switching to C# Bart <bc@freeuk.com> - 2019-06-14 18:07 +0100
          Re: Switching to C# David Brown <david.brown@hesbynett.no> - 2019-06-15 09:44 +0200
          Re: Switching to C# fir <profesor.fir@gmail.com> - 2019-06-15 01:24 -0700
            Re: Switching to C# fir <profesor.fir@gmail.com> - 2019-06-15 02:04 -0700
              Re: Switching to C# fir <profesor.fir@gmail.com> - 2019-06-15 03:24 -0700
                Re: Switching to C# fir <profesor.fir@gmail.com> - 2019-06-15 03:41 -0700
              Re: Switching to C# Anton Shepelev <anton.txt@gmail.com> - 2019-06-16 15:16 +0300
        Re: Switching to C# Bonita Montero <Bonita.Montero@gmail.com> - 2019-06-15 18:49 +0200
          Re: Switching to C# Bart <bc@freeuk.com> - 2019-06-15 17:58 +0100
            Re: Switching to C# Bonita Montero <Bonita.Montero@gmail.com> - 2019-06-16 07:28 +0200
          Re: Switching to C# nobody@example.org (Scott) - 2019-06-16 01:58 +0000
            Re: Switching to C# Keith Thompson <kst-u@mib.org> - 2019-06-15 19:31 -0700
              Re: Switching to C# nobody@example.org (Scott) - 2019-06-16 08:20 +0000
                Re: Switching to C# Keith Thompson <kst-u@mib.org> - 2019-06-16 02:24 -0700
                Re: Switching to C# nobody@example.org (Scott) - 2019-06-16 17:03 +0000
                Re: Switching to C# Keith Thompson <kst-u@mib.org> - 2019-06-16 14:24 -0700
                Re: Switching to C# nobody@example.org (Scott) - 2019-06-17 03:02 +0000
            Re: Switching to C# Bonita Montero <Bonita.Montero@gmail.com> - 2019-06-16 10:54 +0200
              Re: Switching to C# Keith Thompson <kst-u@mib.org> - 2019-06-16 02:26 -0700
                Re: Switching to C# Bonita Montero <Bonita.Montero@gmail.com> - 2019-06-16 12:43 +0200
                Re: Switching to C# nobody@example.org (Scott) - 2019-06-16 17:05 +0000
                Re: Switching to C# Keith Thompson <kst-u@mib.org> - 2019-06-16 14:26 -0700
                Re: Switching to C# Bonita Montero <Bonita.Montero@gmail.com> - 2019-06-17 06:31 +0200
            Re: Switching to C# David Brown <david.brown@hesbynett.no> - 2019-06-16 12:23 +0200
              Re: Switching to C# Manfred <noname@invalid.add> - 2019-06-16 23:06 +0200
              Re: Switching to C# Keith Thompson <kst-u@mib.org> - 2019-06-16 14:27 -0700
                Re: Switching to C# David Brown <david.brown@hesbynett.no> - 2019-06-16 23:33 +0200
            Re: Switching to C# James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-06-17 08:30 -0400
  Re: Switching to C# "Chris M. Thomasson" <invalid_chris_thomasson_invalid@invalid.com> - 2019-06-13 00:06 -0700
    Re: Switching to C# "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-06-14 08:49 -0400
      Re: Switching to C# "Chris M. Thomasson" <invalid_chris_thomasson_invalid@invalid.com> - 2019-06-17 23:30 -0700
        Re: Switching to C# rick.c.hodgin@gmail.com - 2019-06-18 02:58 -0700
        Re: Switching to C# Mel <mel@zzzzz.com> - 2019-06-18 22:46 +0200
          Re: Switching to C# "Chris M. Thomasson" <invalid_chris_thomasson_invalid@invalid.com> - 2019-06-18 14:00 -0700
            Re: Switching to C# Melzzzzz <Melzzzzz@zzzzz.com> - 2019-06-18 21:11 +0000
              Re: Switching to C# "Chris M. Thomasson" <invalid_chris_thomasson_invalid@invalid.com> - 2019-06-18 15:36 -0700
                Re: Switching to C# rick.c.hodgin@gmail.com - 2019-06-18 15:42 -0700
                Re: Switching to C# Melzzzzz <Melzzzzz@zzzzz.com> - 2019-06-19 04:26 +0000
  Switching to C# Thiago Adams <thiago.adams@gmail.com> - 2019-06-13 03:05 -0700
    Re: Switching to C# Real Troll <real.troll@trolls.com> - 2019-06-13 12:30 -0400
  Re: Switching to C# My nuts hurt <cdalten@gmail.com> - 2019-06-13 09:51 -0700
    Re: Switching to C# luser droog <luser.droog@gmail.com> - 2019-06-13 09:56 -0700
      Re: Switching to C# Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-06-13 22:24 +0000
        Re: Switching to C# Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-06-18 06:33 -0700

csiph-web