Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
gently caress it






code:
#define fine #define de #define/**/ /**/*#define*/
#define de #define
#define do de

do { begin
do you like (green eggs and ham++)?
do you eat them: in a box?
do you eat them with a fox?0
do } end

fine
fine, just fine.

                    /*@@@@@@@@@@@@=___
                   /@@@@@@@@@@@@@@@@@@@a
                   @@@@@@@@@@@@@@@@@@@@@
                   |@@@@@@@@@@@@@@@@@@@@
                    @@@@@@@@@@@@@@@@@@@@
                     \@=~         ~~@@@/
                      \               /
                       \              |
                       /@@@@@===__    |
                       @@@@@@@@@@@@==/
                      /@@@@@@@@@@@@@@
                      @@@@@@@@@@@@@@@
                     / ~~~====@@@@@@
                    /           ~~~/
                   |              /
                  /____          |
                 @@@@@@@@=====__/
                @@@@@@@@@@@@@@@@
               /@@@@@@@@@@@@@@@
              /@@@@@@@@@@@@@@@|
          ___/        ~~~~@@*/
   char groo(p,q)int p;int q;{return
((char)          (--q*q+   (p/10)*q+--p))
       ;          }void grem /**/  (){ int x=0
     ;             printf("   ")
     ;/**/   /**/    for(;x<16
    ;                x++)printf
   (                 "%c",groo(x
   ,    8))            ;printf
   (                   "\n\n")
  ;                  }void cred(a
 )                   int a;{int
                    x=0;printf
 (                  "%c  "
 , /*_____===~*/  groo(a,8))
  ;             for(;x<16
   ;           x++)printf
    (         "%c",(char)
      a*16+ x);printf(
       "\n");}main(a
          ,b)int a;
 char **b   ;{int        x=2;
    do(x=0;x<4;x++)exit(0);
  for(grem();x<1<<3+(int)b[0]
[0]%2;)cred            (++x-1);}

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Blotto Skorzany posted:

not ub but pretend i spammed gandalf.c in here again in all its glory

i couldnt get it to compile, do i need some weird flags?

$ curl http://www.ioccc.org/1996/gandalf.c | clang -x c -
<snip>
4 warnings and 5 errors generated.

:(

e: oh theres a makefile too

e2: welp

$ make gandalf
<snip>
2 warnings and 5 errors generated.
make: *** [gandalf] Error 1

Bloody
Mar 3, 2013

What's it do

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Snapchat A Titty posted:

i couldnt get it to compile, do i need some weird flags?

probably you need a circa 1995 c compiler, i don't think anything today will tolerate some of the preprocessor abuse that early ioccc entries tended to lean on

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Bloody posted:

What's it do

displays the ascii and ansi character tables

raminasi
Jan 25, 2005

a last drink with no ice

Shaggar posted:

yes its an example of dynamic typing.

I want to hear the shaggar explanation for why dynamically dispatching on one object is good but multiple objects is bad

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
anybody here used vaadin?

is it any good?

JewKiller 3000
Nov 28, 2006

by Lowtax

Athas posted:

Why do people fetishize C to this degree? It is just a programming language. It is not particularly unsafe - it is even stronly typed! It is not some exotic, dangerous thing, it is one of the most mainstream and widely used languages you can get.

Using C does not make you a cool bad-rear end, it just makes you another C programmer out of tens of thousands.

C is not strongly typed in any meaningful way. in fact, C is the prototype example of a weakly typed language. there are implicit type conversions all over the place, and unsafe casting is the norm. a type in C is really just a way to tell the compiler how much memory it needs to allocate, and that's about it

Space Whale
Nov 6, 2014

JewKiller 3000 posted:

C is not strongly typed in any meaningful way. in fact, C is the prototype example of a weakly typed language. there are implicit type conversions all over the place, and unsafe casting is the norm. a type in C is really just a way to tell the compiler how much memory it needs to allocate, and that's about it

I've had arguments during interviews about if C is weak or not.

I got hired but I still disagreed with someone saying it's strongly typed.

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

Space Whale posted:

I've had arguments during interviews about if C is weak or not.

I got hired but I still disagreed with someone saying it's strongly typed.

strongly typed*

*can ignore all typing if wanted

gonadic io
Feb 16, 2011

>>=

Sweeper posted:

strongly typed*

*can ignore all typing if wanted

c has types? I thought you just had to write int or *int or sometimes even **int next to everything so that intered the variable into the runtime.

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

gonadic io posted:

c has types? I thought you just had to write int or *int or sometimes even **int next to everything so that intered the variable into the runtime.

i guess you could call them type suggestions?

JawnV6
Jul 4, 2004

So hot ...

Sweeper posted:

i guess you could call them type suggestions?

a "light hint" or "lint"

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
types in c are basically just a way to give names to particular offsets from a pointer

hepatizon
Oct 27, 2010

Shaggar posted:

use c# and java and embrace the corporate culture of not caring at all and getting the gently caress out at 5.

first shaggar post i've ever agreed with

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

JewKiller 3000 posted:

a type in C is really just a way to tell the compiler how much memory it needs to allocate, and that's about it

the most infuriating bug i ever fixed was caused by an rtos that basically did

code:
#if RTOS_SOURCE_FILE
    #define SOME_TYPE some_struct_i_can_inspect*
#else
    #define SOME_TYPE void*
#endif

for every type it used, completely defeating all type checks on function arguments etc

this turned this typo

code:
queue_send(&msg, sizeof(msg), timeout_in_ticks, destination_task); /* <---- should be destination_queue, whoops */
from an error caught by the compiler that would have been fixed in ten seconds into a full day experience looking at memory watches and doing timing analysis before realizing what the deal was


so C has a type system that is actually useful, but you can turn off the useful parts, and you can do so in headers to really gently caress with people.

gonadic io
Feb 16, 2011

>>=
To be fair if you're really determined you can circumvent any type system. Unsafe blocks, haskell's unsafeCoerce, gently caress even agda has a "make this type check" compiler directive iirc

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
types are a fake idea

Arcsech
Aug 5, 2008

Tiny Bug Child posted:

types are a fake idea

types are just as fake as anything else in most programming languages: an abstraction the compiler understands that you use to help you write code more easily

if you want non-fake programming write asm, but even thats an abstraction these days lol

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
the idea that types help you write code more easily is a fake idea

Series DD Funding
Nov 25, 2014

by exmarx
why is Twisted so bad

Arcsech
Aug 5, 2008

Tiny Bug Child posted:

the idea that types help you write code more easily is a fake idea

the idea that automatic type coercion helps you write code more easily is a fake idea

see, i can do it too

JewKiller 3000
Nov 28, 2006

by Lowtax

Tiny Bug Child posted:

the idea that types help you write code more easily is a fake idea

you can say this, but it's wrong

Tiny Bug Child posted:

types are a fake idea

you can't say this, though. types are absolutely fundamental to computation. truly untyped data is useless: a raw stream of bytes that is completely opaque to you

Max Facetime
Apr 18, 2009

Dessert Rose posted:

types in c are basically just a way to give names to particular offsets from a pointer

also give names to groups of such offsets together

so c has objects, composition and no inheritance which is actually pretty good OOP-wise

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Blotto Skorzany posted:

the most infuriating bug i ever fixed was caused by an rtos that basically did

code:
#if RTOS_SOURCE_FILE
    #define SOME_TYPE some_struct_i_can_inspect*
#else
    #define SOME_TYPE void*
#endif

for every type it used, completely defeating all type checks on function arguments etc

this turned this typo

code:
queue_send(&msg, sizeof(msg), timeout_in_ticks, destination_task); /* <---- should be destination_queue, whoops */
from an error caught by the compiler that would have been fixed in ten seconds into a full day experience looking at memory watches and doing timing analysis before realizing what the deal was


so C has a type system that is actually useful, but you can turn off the useful parts, and you can do so in headers to really gently caress with people.

what is even the idea behind that? like are they trying to expose an opaque type except they dont have brains in their heads?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
it would not be the first example of somebody not realizing that you can just leave something forward-declared

the sort of idiot who does that is also the sort of idiot who would use a macro instead of a typedef for no goddamn reason

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Paper about FB's software verification stuff: https://research.facebook.com/publications/422671501231772/moving-fast-with-software-verification/

We released the tool yesterday as well: http://fbinfer.com

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Snapchat A Titty posted:

what is even the idea behind that? like are they trying to expose an opaque type except they dont have brains in their heads?


rjmccall posted:

it would not be the first example of somebody not realizing that you can just leave something forward-declared

the sort of idiot who does that is also the sort of idiot who would use a macro instead of a typedef for no goddamn reason



pretty much, yep. i think it got "fixed" in a later release of the rtos

tbh even if they had implemented opaque types properly i don't think that sort of information hiding is justified in the context of a small rtos for use with micros - i need to be able to see the guts of things and it would be nice if the fields showed up properly in the debugger. eg. I can understand why you'd want to have an opaque type for a task in most code, but when i've got mpu exceptions getting thrown that i'm trying to figure out i'd like to be able to inspect the tcb to see whether the stack pointer has been trashed. especially since, in that rtos, the task stack grows towards the tcb and thus an overflow tends to trash it

Athas
Aug 6, 2007

fuck that joker

JewKiller 3000 posted:

C is not strongly typed in any meaningful way. in fact, C is the prototype example of a weakly typed language. there are implicit type conversions all over the place, and unsafe casting is the norm. a type in C is really just a way to tell the compiler how much memory it needs to allocate, and that's about it

There are not many implicit type conversions in C. It is strongly typed but with many ways to cheat the system. That just makes it unsound, not weak.

fritz
Jul 26, 2003


i love me some static analyzers

Brain Candy
May 18, 2006

Athas posted:

There are not many implicit type conversions in C. It is strongly typed but with many ways to cheat the system. That just makes it unsound, not weak.

please give your definition for strongly typed, tia

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Athas posted:

There are not many implicit type conversions in C.

float/int implicitly converts, any pointer type implicitly converts to/from void*, int and int* implicitly convert (although most compilers issue a warning for this), enums and ints implicitly convert, several integer types implicitly convert under certain circumstances, that seems like a lot of conversions without explicit casts to me

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
"strongly typed" is a propaganda term, it means whatever you want it to mean

one definition is soundness, where a type system is sound if a well-typed program is guaranteed to run without type errors. but then you have to define "type error", which is tricky — is a bad downcast in java a type error or just part of the program semantics? is it different if it's implicitly inserted by the language as part of (say) calling get(10) on a List<String>?

sometimes people say it's about implicit conversions, but then it turns out that their private definition of "conversion" excludes some things that seem okay to them, like integer promotions and class upcasts, which i think is just an informal approximation of soundness. except that most languages/libraries have explicit, asserting conversions which impact soundness just as much as implicit ones; but maybe unsoundness is okay if it's explicit?

or maybe it's all implicit conversions, even the sound ones, which is fine and very specific definition except the term is always thrown about as if it has strong moral value and i don't see the connection when it's divorced from soundness

really i think that we just have to accept that — unless we are theorem proving — the interesting property is a very slippery judgement about the risk of deviation from the program's intent. and with that definition in hand, we can readily say that c has many features that increase that risk a lot for ordinary programs, and that c++ eliminates some of those sources of risk but by no means all, and that other type systems eliminate many more

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Tiny Bug Child posted:

the idea that types help you write code more easily is a fake idea

i wish your posts were untyped!!

VikingofRock
Aug 24, 2008




MALE SHOEGAZE posted:

i wish your posts were untyped!!

NICE!

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
C's weak typing isn't that bad if you enable a shitton of warnings


without them I'm pretty sure C programming would be absolute nightmare

detroit
Nov 11, 2009
did we agree MUMPS is the worst yet?? thanks

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

detroit posted:

did we agree MUMPS is the worst yet?? thanks

fire up the dentist signal

JewKiller 3000
Nov 28, 2006

by Lowtax
the "distinction" between strong and weak typing is nowhere near as important as the distinction between static and dynamic typing (the latter is not typing). and as other posters have explained, strong/weak typing are not very well defined, so such terms are avoided in the literature. but when it does appear, the term "weak typing" applies invariably to C

or maybe PHP, but PHP is not a programming language. it's a set of functions that you can call, but should not

Adbot
ADBOT LOVES YOU

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
it's been said that php is just a wrapper around a bunch of c functions and that's kind of true. in a way, it's c for the modern era of the web. it's easier to work with and all the useless stuff like pointers is stripped out

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply