home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,817 of 117,927   
   Paul Rubin to albert@spenarnc.xs4all.nl   
   Re: value-flavoured structures   
   28 Sep 24 10:52:13   
   
   From: no.email@nospam.invalid   
      
   albert@spenarnc.xs4all.nl writes:   
   > A strong type system is not a problem for embedded applications, as long   
   > as there is a means to defeat the type system.   
   > Ada was designed with this in mind, making distinction between safe and   
   > unsafe modules. Remember that c++ was an afterthought after c that was   
   > not well designed in the first place.   
      
   Rust has unsafe modules but I don't remember Ada having them.  Ada does   
   have an Unchecked_Conversion function but I don't know where this is   
   really needed or how well specified it is in the language standard.   
      
   Usually in Ada, for low level operations involving things like machine   
   registers, you'd call subroutines written in assembly language or   
   similar.  Even in C you sometimes have to do that: any operating system   
   written in C will contain some asm code.   
      
   > Strong typing can be annoying. I remember wasting time passing a filename   
   > to function that expected a     `const char *` or something, and it is   
      
   By filename do you mean a char*, or a counted string (std::string), or   
   something?  There shouldn't be a problem passing a char* to a function   
   expecting const char*, since the function simply promises to not modify   
   the string.  The error is the other direction, passing a const char*   
   to something that takes a char*, i.e. that doesn't make such a promise.   
   For std::string there is a builtin that converts to a char* (null   
   terminated string).   
      
   > by no means obvious what you have to do, so you are lured into casting.   
   > A lot of people do not understand that casting is a means to defeat the   
   > type system, so that you loose the advantages.   
      
   Yes exactly, casting in C++ is a code smell.  I'm not a C++ expert and   
   haven't written a ton of C++ code, but in what I've written, I don't   
   remember having needed to cast.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca