Author Topic: engineering ethics (it was [SOLVED] funny CC)  (Read 35827 times)

0 Members and 1 Guest are viewing this topic.

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #125 on: November 25, 2015, 01:59:54 pm »
Embarrassingly I got bitten by this in real production code within the last year or so, Analogue Devices Shark with sizeof (char) == sizeof (short) == sizeof (int) == 1;

All were actually 32 bit types, and 32 bits is the smallest addressable unit of memory, so this is actually standard compliant, just boring when a packed structure comes in over the SPI bus....

Regards, Dan.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8651
  • Country: gb
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #126 on: November 25, 2015, 03:36:50 pm »
  • char t1: banned, you have to use "uint8_t" (motivation I got: "because char can mean 16bit"  :wtf:  )
  • int n: banned, uint32_t

signed $SIZE ----> sint$SIZE_t
unsigned $SIZE ---> uint$SIZE_t

$SIZE={8, 16, 32, 64}

char is 16 bit on some DSPs, and I think its even 24 bit in some places.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #127 on: November 25, 2015, 04:18:42 pm »
  • char t1: banned, you have to use "uint8_t" (motivation I got: "because char can mean 16bit"  :wtf:  )
  • int n: banned, uint32_t

The motivation is being more explicit about what you're doing, and anybody who doesn't understand that shouldn't be inflicting their code on the world.
No longer active here - try the IRC channel if you just can't be without me :)
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #128 on: November 25, 2015, 04:21:06 pm »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #129 on: November 25, 2015, 04:27:22 pm »
I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
Also explain how UTF8 is a failure to learn from baudot history.....

Regards, Dan.
 

Offline Godzil

  • Frequent Contributor
  • **
  • Posts: 458
  • Country: fr
    • My own blog
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #130 on: November 25, 2015, 04:42:52 pm »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
There are so many way, but we can think of 39bit word + 1bit of parity => 40bit in total, 40/5 = 8 Columns for one word
When you make hardware without taking into account the needs of the eventual software developers, you end up with bloated hardware full of pointless excess. From the outset one must consider design from both a hardware and software perspective.
-- Yokoi Gunpei
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #131 on: November 25, 2015, 05:48:28 pm »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
There are so many way, but we can think of 39bit word + 1bit of parity => 40bit in total, 40/5 = 8 Columns for one word

It was 39bit words, full stop. And an architectural maximum of 8K words, with an instruction time of 576us. It also had a famous and influential Algol-60 compiler that fitted in 4K words - written by a certain CAR Hoare who went on to do other very influential work, notably CSP.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Godzil

  • Frequent Contributor
  • **
  • Posts: 458
  • Country: fr
    • My own blog
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #132 on: November 25, 2015, 09:56:25 pm »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
There are so many way, but we can think of 39bit word + 1bit of parity => 40bit in total, 40/5 = 8 Columns for one word

It was 39bit words, full stop. And an architectural maximum of 8K words, with an instruction time of 576us. It also had a famous and influential Algol-60 compiler that fitted in 4K words - written by a certain CAR Hoare who went on to do other very influential work, notably CSP.
You can store a parity bit without having it part of the word, in fact a parity bit will never be part of the word. When you use a RS232 link, you can have 8bit data + 1 bit of parity, making transmitting 9 bits in total, but only 8 are really used. And I don't know how it was stored on your tape system, I was just making a guess, on how I would store
When you make hardware without taking into account the needs of the eventual software developers, you end up with bloated hardware full of pointless excess. From the outset one must consider design from both a hardware and software perspective.
-- Yokoi Gunpei
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #133 on: November 25, 2015, 10:55:34 pm »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
There are so many way, but we can think of 39bit word + 1bit of parity => 40bit in total, 40/5 = 8 Columns for one word

It was 39bit words, full stop. And an architectural maximum of 8K words, with an instruction time of 576us. It also had a famous and influential Algol-60 compiler that fitted in 4K words - written by a certain CAR Hoare who went on to do other very influential work, notably CSP.
You can store a parity bit without having it part of the word, in fact a parity bit will never be part of the word. When you use a RS232 link, you can have 8bit data + 1 bit of parity, making transmitting 9 bits in total, but only 8 are really used. And I don't know how it was stored on your tape system, I was just making a guess, on how I would store

Sigh. You can also store ECC without it being part of the word, but that wasn't done either. See https://en.wikipedia.org/wiki/Elliott_803

But this is too far off the topic to be worth continuing.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #134 on: November 25, 2015, 11:15:15 pm »
Quote
char t1: banned, you have to use "uint8_t"
int n: banned, uint32_t
That's sensible, assuming that the explicitly sized types have to be used everywhere (and don't run into some other edict to "only use compiler native types."  Heh.)   The original code didn't have any types, and indeed would work on any type (as would the "new" code), so I just picked one.
(I really, really, hope that "mycpy((uint8_t *)(&otherdatadest[0]), (uint8_t *)(&otherdatasource[0]), sizeof(otherdatasource[0]*NDATAELEMENTS);" is banned!)
(Are you allowed to use well-defined functions that violate rules?   While the example there is particularly ugly, so is having a different memcpy routine for each datatype.) (I've always found languages whose built-in functions violate the rules for user-written functions to be particularly annoying.  Grr.)

My first computer-of-choice stored text as 5 7-bit ascii characters per 36bit word.  (indeed, "bytes" could be any size between 1 and 36 bits, but they were only "individually addressable" in weird ways.)  The people working on the C compilers for it were ... frustrated.  (and this was the same timeframe that the ARPANet interfaces were essentially 1-bit parallel ports, so as not to impose any restrictions on native word sizes.)  Architecture is SO BORING these days.
Quote
i++: banned   i--: banned  ++i: banned  --i: banned  i+=const: banned  i-=const: banned
Now they're just being silly.  ("Did you ever hear of a COBOL program that gave up millions of users' private data due to a coding bug?  No!  Everything should look like COBOL!")
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #135 on: November 26, 2015, 12:03:38 am »
mycpy((uint8_t *)(&otherdatadest[0]), (uint8_t *)(&otherdatasource[0]), sizeof(otherdatasource[0]*NDATAELEMENTS);" is banned

banned && you get fired, directly  :D
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #136 on: November 26, 2015, 12:16:50 am »
Are you allowed to use well-defined functions that violate rules? 

everything that violates rules is rejected by QAC & QA-dudes, even if, in case of need, you can put "non conformal code" into a "unsafe-code" sections, which means they MUST be separated files (out of the QAC-folder), excluded by QAC check but provided with interfaces(1), so they are "opaque" modules which need to be MUST BE manually justified: practically you have to justify statement by statement and confirmed under your responsibility, signing with your blood  :D

the same is applied to ADA


(1) C prototype and public variables/types/consts/etc
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #137 on: November 26, 2015, 12:56:42 am »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).

Oh stop, I'm getting all teary eyed. Having this manual is a bit like people keep wedding albums.





 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8651
  • Country: gb
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #138 on: November 26, 2015, 01:08:17 am »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).

Oh stop, I'm getting all teary eyed. Having this manual is a bit like people keep wedding albums.
Elliott Bros - the aerospace company that hired many of the people who had made 2001: A Space Odyssey, when the MGM Borehamwood studios, just across the road from them, closed down.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #139 on: November 26, 2015, 01:23:06 am »
Quote
Quote
Are you allowed to use well-defined functions that violate rules?
everything that violates rules is rejected by QAC & QA-dudes
But ... do you get to use memcpy() and memset(), or not?  If not, that means writing a poorly-optimized and less well-tested copy function for each different data type you need to use.   And what do you do about the compiler's internal use of such functions?
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #140 on: November 26, 2015, 11:08:34 am »
But ... do you get to use memcpy() and memset(), or not?

you have there choices
  • use what provided by libC (which is included in your toolchain suite, if "it's approved", formally you have "C compiler unit", "assembler unit", "linker unit", "linker script unit", "memory model unit", and "libC unit" (bare metal profiled, of course), "crt0.s unit", all of them MUST be formally approved)
  • write your own version of memcpy&C, universal type (which means that you have to force everything to be p_uint8_t/8bit size ---> you need unchecked converter because "casting" is banned)
  • write your own versions of $type_memcpy&C

$type_memcpy means you to write

$type={ uint8, uint16, uint32, uint64, char }
for item in $type, do write "$type_memcpy"

(Stood is able to auto build code for you)

Casting is banned, so if you have to force everything to be uint8, you have to use "unchecked converter"

$type={ uint8, uint16, uint32, uint64, char }
for item in $type, do write "uc_$type_to_uint8(p_$type_t p)

they are functions, written in assembly, under "unsafe code" section

note the prefix "p_" it means "pointer", it's MUST in our conforming code

you could, also, write the full memcopy in assembly, and export it as "unsafe code"

I repeat again: everything is under the name of  "unsafe code" MUST be manually checked, justified, and hardly tested twice the twice
and you'd better remember you are signing with your blood  :D


And what do you do about the compiler's internal use of such functions?

are you kidding ?  :D
we do not have any "collision" with libC (if it's allowed be used): a collision means QAC immediately refuses the code!

Stood & QAC knows everything in the project (formally a project is a collection of modules, each module is collection of items, described by their interfaces)
they know which kind of libC you are using and what is provide by libC (because libC is formally a module, opaque, it means "black box")

You can't redefine a function that is included in libC without getting QAC to stop kicking you on your finger tips!

formally it's a "collision" (public interface collision) with a module!


libC.c ----> libC.interface
exported symbol: memcopy

my_module.c ----> my_module.interface
exported symbol: memcopy


QAC will say something like "ERROR, public collision between libC.interface and my_module.interface: memcopy defined twice"

there is a special attribute "reserved"

libC.interface
exported symbol: memcopy (reserved)

my_module.private
exported symbol: memcopy


"private" is the same as "static" in the C89 language, but … it's used to describe "private" interface (internal C prototypes, QAC uses it as "an attribute" for it's internal data base, there is a data base for each project, because "QAC "MUST be interfaced with "DOORS", which is formally the last suite to be used in order to present a product to QA guys and to the customer)

in this case "memcopy" is a private function, so it "could" overload the libC version, but QAC knows that it's "reserved"

so QAC will say something like "ERROR, public collision between libC.interface and my_module.private: memcopy is reserved, it can't be overloaded"
« Last Edit: November 26, 2015, 11:26:14 am by legacy »
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: engineering ethics (it was [SOLVED] funny CC)
« Reply #141 on: November 26, 2015, 11:12:43 am »
char is 16 bit on some DSPs, and I think its even 24 bit in some places.
And arguably 6-bit on some obsolete systems.

I wonder what it should be on the first computer I programmed, which had 5 channel paper tape for input and 39-bit words. (Exercise for youngsters: explain how the full symbol set could be represented on a 5 channel (i.e. 5 bit) paper tape).
Oh stop, I'm getting all teary eyed. Having this manual is a bit like people keep wedding albums.

Porn should have no place on the forum :)

I only have the A6-ish handbook of the instruction set, and an audio tape of it performing some tricks and clucking like a broody hen while "fetching-Algol" from the mag film.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf