!UpbiadsgRndwvYKPLK:neko.dev

Gentoo Chatter

185 Members
Offtopic discussions, distractions while emerge is running and banter. Keep attacks, politics and illegal stuff out of here, but otherwise most topics can end up here.53 Servers

Load older messages


SenderMessageTime
21 Mar 2022
@eijrj390jr:envs.netle glowie de morta
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
double* hextorgba(char *hexstr)
{
  int hexstrlen=strlen(hexstr)/2;
  if (hexstrlen > 4)
  {
    printf("Invalid colour");
    exit(1);
  {

  static double rgba[4];
  rgba[3] = 255;

  int i;
  for (i=0;i<hexstrlen;i++)
  {
    char tmpstr[2];
    tmpstr[0]=hexstr[i*2];
    tmpstr[1]=hexstr[i*2+1];
    rgba[i] = strtol(tmpstr, 0, 16);
  }
  printf("RGBA(%d, %d, %d, %d)\n", (int)rgba[0], (int)rgba[1], (int)rgba[2], (int)rgba[3]);
  return rgba;
}
hextorgba("7f11e0");
}
11:38:47
@eijrj390jr:envs.netle glowie de mortait does not seem to compile 11:38:53
@eijrj390jr:envs.netle glowie de morta * it does not seem to compile and i have no idea how to fix it lol11:39:02
@eijrj390jr:envs.netle glowie de morta * it does not seem to compile and i have no idea how to fix it lol11:39:09
@tastytea:pixie.towntastyteaYou can't put a function into a function like this, AFAIK.11:40:12
@eijrj390jr:envs.netle glowie de mortakek11:40:25
@tastytea:pixie.towntastyteaTry making main() and hextorgba() 2 separate functions.11:40:43
@eijrj390jr:envs.netle glowie de mortastill the same error rip11:41:41
@n_r_k:matrix.orgNRKtastytea: i think GNUC allows it11:41:51
@tastytea:pixie.towntastyteaGNU C is awful and this is cursed. 😊11:42:19
@eijrj390jr:envs.netle glowie de mortayep11:42:26
@n_r_k:matrix.orgNRKimage.png
Download image.png
11:42:33
@eijrj390jr:envs.netle glowie de mortalol11:42:42
@eijrj390jr:envs.netle glowie de mortavery cursed11:42:50
@n_r_k:matrix.orgNRKtastytea: gnuc has some nice features11:43:04
@n_r_k:matrix.orgNRKmost of it is cursed tho, i agree11:43:20
@tastytea:pixie.towntastyteaIt's nice as long as you use a GNU compiler…11:44:26
@eijrj390jr:envs.netle glowie de mortadoes -c99 disable the gnu stuff11:44:58
@n_r_k:matrix.orgNRKno11:45:24
@eijrj390jr:envs.netle glowie de morta what does disable the GNU 11:45:40
@eijrj390jr:envs.netle glowie de morta * what does disable the GNU 11:45:49
@n_r_k:matrix.orgNRKi don't think you can make gcc strictly standard conformant11:45:58
@n_r_k:matrix.orgNRK best you can do is gcc -std=c99 -Wpedantic 11:46:13
@eijrj390jr:envs.netle glowie de mortainteresting11:46:23
@n_r_k:matrix.orgNRKyou can also try compiling with tcc, it can catch some non-standard/implementation-defined stuff.11:47:12
@tastytea:pixie.towntastytea
           […] For example, -std=c90 turns off
           certain features of GCC that are incompatible with ISO C90, such as the "asm" and
           "typeof" keywords, but not other GNU extensions that do not have a meaning in ISO
           C90, such as omitting the middle term of a "?:" expression.
11:47:32
@eijrj390jr:envs.netle glowie de mortai think my code broke the compiler it looks fine but it won't compile 11:48:11
@eijrj390jr:envs.netle glowie de mortayay i broke gcc11:48:18
@tastytea:pixie.towntastytea eijrj390jr: You're missing some }. 11:49:22
@tastytea:pixie.towntastyteaclang-dormat should make it obvious.11:49:36

Show newer messages


Back to Room ListRoom Version: 6