No has iniciado sesión
Conectar al sistema | Registrar usuario
ProgramacionWeb - Ayuda al webmaster Eloi 

Los comentarios más curiosos de código fuente real  

 

 
2 votos
WebLog Los comentarios más curiosos de código fuente real
30/04/2009
 
Acabo de encontrar vía digg un fragmento de código de Xee ( un visor de imágenes para Mac ) que con el siguiente comentario:
 
000 
001 
002 
003 
004 
005 
006 
007 
008 
009 
010 
011 
012 
013 
014 
015 
016 
017 
018 
019 
020 
021 
022 
023 
024 
025 
026 
027 
028 
// At this point, I'd like to take a moment to speak to you about the Adobe PSD format.
// PSD is not a good format. PSD is not even a bad format. Calling it such would be an
// insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having
// worked on this code for several weeks now, my hate for PSD has grown to a raging fire
// that burns with the fierce passion of a million suns.
// If there are two different ways of doing something, PSD will do both, in different
// places. It will then make up three more ways no sane human would think of, and do those
// too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide
// that *these* particular chunks should be aligned to four bytes, and that this alignement
// should *not* be included in the size? Other chunks in other places are either unaligned,
// or aligned with the alignment included in the size. Here, though, it is not included.
// Either one of these three behaviours would be fine. A sane format would pick one. PSD,
// of course, uses all three, and more.
// Trying to get data out of a PSD file is like trying to find something in the attic of
// your eccentric old uncle who died in a freak freshwater shark attack on his 58th
// birthday. That last detail may not be important for the purposes of the simile, but
// at this point I am spending a lot of time imagining amusing fates for the people
// responsible for this Rube Goldberg of a file format.
// Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this,
// I had to apply to them for permission to apply to them to have them consider sending
// me this sacred tome. This would have involved faxing them a copy of some document or
// other, probably signed in blood. I can only imagine that they make this process so
// difficult because they are intensely ashamed of having created this abomination. I
// was naturally not gullible enough to go through with this procedure, but if I had done
// so, I would have printed out every single page of the spec, and set them all on fire.
// Were it within my power, I would gather every single copy of those specs, and launch
// them on a spaceship directly into the sun.
//
// PSD is not my favourite file format.
 
El comentario, introducido en una revisión del archivo XeePhotoshopLoader.m hecha por Paracelsus ( un programador involucrado en el proyecto Xee ) viene a significar algo así:
Llegados a este punto, me gustaría tomar un momento para hablar del formato Adobe PSD.
PSD no es un buen formato. PSD no es ni siquiera un mal formato. Llamarlo así sería un insulto para otros malos formatos cómo PCX o JPEG. No, PSD es un formato abismal- Habiendo trabajado con este código ( cargador de imágenes PSD ) durante varias semanas, mi odio hacia PSD ha crecido hasta convertirse en un rabioso fuego que quema con la feroz pasión de un millón de soles. Si hay dos formas de hacer algo, PSD lo hará de las dos en lugares distintos. Luego inventará tes formas más en las que ningún se humano sano pensaría y también se usarán. PSD hace de la inconsistencia un arte ( ... ) Intentar obtener datos de un PSD es cómo intentar encontrar algo en el ático de tu viejo y excéntrico tío que murió en un espantoso ataque de tiburón en su 58º cumpleaños ( ... )
Paracelsus se despacha a gusto en un curioso comentario estilo blog , lo que me ha recordado otros comentarios curiosos...

El punto flotante del diablo en Quake III

En el archivo q_math.c del código fuente de Quake III encontramos:
 
000 
001 
  i  = * ( long * ) &y;  // evil floating point bit level hacking
  i  = 0x5f3759df - ( i >> 1 ); // what the fuck?
 
Los comentarios dicen "hack a nivel bit a bit para el punto flotante diabólico" y "que cojo***"

El incomprendido

En el archivo slp.c ( codigo de intercambio de contexto ) del código fuente de Unix, encontramos mi comentario de Unix favorito:
 
000 
/*  You are not expected to understand this */
 
La traducción de este fragmento vendría a decir: "No se espera que entiendas esto".

Una mierda complicada

En el código fuente de Mercurial, el control de versiones utilizado en el desarrollo en Mozilla cómo sustitución de SVN, encontramos bastantes tacos en comentarios, a destacar:
 
000 
001 
002 
003 
004 
/* this is some convoluted shit... this creates a file, inits it with
 * the path parsed above (chromeLocation), makes a url, and inits it
 * with the file created. the purpose of this is just to have the
 * canonical url of the stupid thing.
 */
 
En este comentario del archivo nsChromeRegistry.cpp pone algo así cómo:
Esto es una mierda compleja... crea un archivo, lo inicia con la ruta parseada ( ... ) el propósito de esto es sólo tener la url canónica de la cosa estúpida.

Al estilo Chunk Norris

En el archivo listing_engine.inc del código fuente del CMS MySource Matrix encontramos el siguiente comentario:
 
000 
// do it CHUNK Norris style
 
El comentario nos invita a hacerlo al estilo Chunk Norris, chunk significa "fragmento" y es un concepto usado frecuentemente al trabajar con información.

Ask Bill

En el archivo bmp_cod.h del código fuente de libjasper ( implementación libre del códec de JPEG usada por ejemplo en Ghostscript ) se hace la declaración de estructuras para el manejo de BMP:
 
000 
001 
002 
003 
004 
005 
006 
007 
008 
009 
010 
011 
012 
013 
014 
015 
016 
017 
018 
/* BMP header. */
typedef struct {
 
        int_fast16_t magic;
        /* The signature (a.k.a. the magic number). */
 
        int_fast32_t siz;
        /* The size of the file in 32-bit words. */
 
        int_fast16_t reserved1;
        /* Ask Bill Gates what this is all about. */
 
        int_fast16_t reserved2;
        /* Ditto. */
 
        int_fast32_t off;
        /* The offset of the bitmap data from the bitmap file header in bytes. */
 
} bmp_hdr_t;
 
Uno de los comentarios dice: "Pregunta a Bill Gates de que va todo esto" y en el siguiente dice "ditto" o "exactamente lo mismo dicho antes"
 
Próximo post >
Rebelión 2.0 digg, facebook y ahora también Menéame!
 
< Post anterior
La batalla por la primera notícia llevada al absurdo
 
Comentarios
No hay ningún comentario para este post
 
 
Estadísticas para
eloi.programacionweb.net:
 Última semana: 21481 impresiones | 14259 visitantes
 Último mes: 83356 impresiones | 57872 visitantes